Questions tagged [mplab-c18]

For questions specifically about the MPLAB C Compiler for PIC18 MCUs (also known as MPLAB C18). This is a C89-compatible compiler for Microchip's PIC18 series of microcontroller units. DO NOT USE this tag for questions about the C standard ISO 9899:2018—use the [c17] tag for that.

C18 is Microchip's C compiler for PIC18 MCUs. Some of its main features are compatibility with Microchip's MPLAB and MPLAB X IDEs, Microchip's hardware and software debuggers, support for code size optimizations, support for PIC18F extended mode instructions and library support for SPI, I2C, PWM, UART, string manipulation and math.

It is available in free LITE version which doesn't support size optimizations and PIC18F extended mode instructions.

Official website of the compiler is here.

Microchip is currently phasing out the C18 compiler in favour of new XC8 compiler.

46 questions
0
votes
3 answers

PIC C18: Converting double to string

I am using PIC18F2550. Programming it with C18 language. I need a function that converts double to string like below: void dtoa( char *szString, // Output string double dbDouble, // Input number …
hkBattousai
  • 10,583
  • 18
  • 76
  • 124
0
votes
1 answer

Unable to resolve identifier RBIE and RBIF, any guess?

trying to compile a code but keep giving build failed and checking red flags shows only Unable to resolve identifier in RBIE and RBIF. below is the code i have im using it with a pic18f45k50 with a lcd and 4x4 keyboard try internet but only show the…
0
votes
0 answers

Problem while coding in mplab x ide for pic18f

I am using pic18f and coding on mplab v ide. While compiling the code it's showing that 'RD3' is depricated. What should be the solution to it.
0
votes
2 answers

Microchip C18 send data to Terminal as numeric

I am working on a project on which i need to send data over USART to terminal. I need to display the data as the numeric value (0-255) of the char (which collected from the EEPROM i have managed to send the char as is to the terminal (using Putty or…
RobinHud
  • 11
  • 9
0
votes
1 answer

what is the meaning of __18CXX and __PCB__ in picc codes

I commonly see the following lines of compiler-related codes : #if defined(__18CXX) ... #endif and #if (defined(__PCB__) || defined(__PCH__) || defined(__PCM__)) ... #endif How can I know the meaning of each one ?
Wazani
  • 911
  • 1
  • 13
  • 28
0
votes
1 answer

how to assign structures in C18 compiler, MPLAB (ANSI C89)

I am trying to assign values in main program. typedef struct PointStructure { unsigned char x; unsigned char y; unsigned char offset; unsigned char page; }point; volatile far point p; volatile far point AryP[5]; The only way I…
Dolphin
  • 1
  • 1
0
votes
1 answer

reading back a float number

I am using microchip c18 and i have this function which splits the float in to 4 respective bytes.And C18 follow little endianess a[0]=*(fptr); address 0 a[1]=*(fptr+1); 1 a[2]=*(fptr+2); 2 a[3]=*(fptr+3); …
Rookie91
  • 257
  • 3
  • 13
0
votes
1 answer

function for eeprom searching

I have an array stored in EEPROM Starting with {0,0,0,0,1,1,1...} up to 54 elements from address '0'-address'53' and i have cross checked the value and everything is fine. but when i employ a 'search function' and i have passed '0' as the argument…
Rookie91
  • 257
  • 3
  • 13
0
votes
2 answers

Random Characters in Terminal Emulator

I am currently working on a project to select different outputs based on a text input from a laptop via USB. What I am currently trying to do is send a character out from my PIC18F1320 to HyperTerminal, I have tried using variables but was…
0
votes
1 answer

Defining array as global in case of multi file embedded project

I've been trying to declare an array as global in mplab c18 and never found much success. Is there any possible way to access the array elements, or can we declare the array as global /extern and access from other source files.
Arun Nr
  • 31
  • 1
  • 1
  • 3
0
votes
2 answers

Long Delay using Delay Functions from C18 Libraries for PIC18

I'm using a PIC18 with Fosc = 10MHz. So if I use Delay10KTCYx(250), I get 10,000 x 250 x 4 x (1/10e6) = 1 second. How do I use the delay functions in the C18 for very long delays, say 20 seconds? I was thinking of just using twenty lines of…
Michael Reed
  • 13
  • 1
  • 5
0
votes
2 answers

Let C18 throw a compiler error

Is there a way to let the C18 compiler throw an own, customized error message during compiling? For example, consider a situation with two user-defined settings: #define SETTING_A 0x80 #define SETTING_B 0x3f Assume these settings can't be both…
user1544337
0
votes
1 answer

C18: called function is skipped

Iwould be most grateful if your experts on using the C18 compiler could give me a pointer as to what I am doing wrong. To become familiar I started a simple thermometer project:- NTC thermistor --> 18F2520 --> HD44780. After getting the chain…
Fred Mah
  • 21
  • 1
0
votes
1 answer

C18: Will the compiler "know" a function call will never return?

I'm building a 16 state FSM on a PIC18 with C18. I'm considering having each state as its own function which jumps to and gets jumped by other states. I'm tempted to just write a branch cases of "state##();"s at the end of each state to determine…
BB ON
  • 251
  • 1
  • 3
  • 15
0
votes
1 answer

Bit-banged serial on PIC stops working with nested loop in C

Stackoverflow, you've helped me before, I think I need your help again. I'm trying to bit-bang my own serial out using a GPIO on a PIC18F2550. This connects to some shift registers (3x74LS595), where the last one connects to a standard HD44780 LCD.…
BB ON
  • 251
  • 1
  • 3
  • 15