XC8 V2 C99 Issues

warning: (520) function “_SomeFunctionName” is never called Setting warning level to 0 will get rid of this one Right click project > Properties > XC8 Global Options > XC8 Compiler > Warning Level = 0 warning: ‘/*’ within block comment [-Wcomment] This is a stupid GCC warning that is detailed here. To suppress it include this […]

Read More

warning: expression generates no code

Example error message: “ap-main.c:189:: warning: (759) expression generates no code” Example that will cause it: This error is not usually generated by compilers, but is for XC8 and Microchip supported it with: The compiler detects that the condition is true, eliminates the code generation for the condition and produces a warning to this effect. No […]

Read More

Newer XC8 version issues

fatal error: ‘p18f23k22.h’ file not found You no longer include the device specific header file like this: Instead you include this file: This header file is typically included into each C source file you write. It is a generic header file that will include other device- and architecture-specific header files when you build your project. […]

Read More

Assembler

ISSUE – Destination and RAM access bit specified This used to be requried for asm code when you wanted to tell it the ,d and ,a bits of the instruction: near static unsigned char uc_asm_irq_temp; // near qualifier specifies access RAM near static unsigned char uc_asm_irq_temp1; movlw 0xcb addwf _uc_asm_irq_temp,f,c //(1 = file register, 0 = […]

Read More

XC8 – peripheral library support is missing for the …

"Warning peripheral library support is missing for the 18F45K22" Right click project > properties > Conf: -> XC8 global options -> XC8 linker "Link in Peripheral Library" is causing it if set, but if you are using peripheral library functions you need this.  There seems to be some issue with XC8 no longer shipping with the peripheral […]

Read More