I have just spent three evenings battling with XC8 v2.05... C99.. I have a pic18f87k22 and couldn't get simulation going let alone for real..
Stupid mistake... XINST was on by default.. WHY!!!! XC8 does not support extended instruction set.. Surely the mad hatters at Microchip could mask that piggin bit out if they don't support it.. I know its there for assembly and asm can be used with XC8, but any C code will not work...
Make my blood boil... I thought it was a C99 thing, but you can change the standard... Didn't help..
Remember to avoid the all time top blunders:
1) Never get involved with a land war in Asia.
2) Never go up against a Sicilian with death on the line.
3) Never forget to define all the bits in all the configuration words.
My mistake is the size of str[], should have been 5… But the char array is placed first by the compiler so the overrun over writes x every loop, thus never completing the loop.... I was convinced it was a serial issue as the interrupt was only firing once...
Thing is... This code has been used "as is" extensively without issue, so the newer V2.05 compiles differently to the older versions...