I am currently working with a PIC18F25k80 device using the XC8 compiler and MPLABX.
I spent the whole of yesterday trying to debug some code I ported from a PIC32 micro project. This code did not interact with any hardware, and was split into 2 different source files.
Eventually, I was able to solve the issue by identifying that the XC8 compiler produces unexpected results when variables of the same name exist in different source files. NOTE: I did not use the "extern" keyword, as I needed the variables to be logically different across the source files.
I had to prefix all my my variables with a source file specific prefix.
Is this a known issue with the XC8 compilers?
static
. This is standard C, not specific to XC8 \$\endgroup\$static
you should'nt use the same name for different variables for readability. \$\endgroup\$