Passing a string in XC8
Hi,
I'm using MPLAB X IDE v1.63, XC8 v2.31 and a Pickit 3 to write to a PIC18F67k40 on a MIKROE Click 2.
For some reason I am unable to pass a fixed string (const char*) to a function
const char buff1[]="String1"; // string in Program memory
void WriteStr(const char *str) // function using the string
{...process str ...}
using
WriteStr("String0");
or
WriteStr(buff);
I can see the text in program memory (at E01) and the address is passed to the function, but I believe that this is RAM address and has not been converted for Program Memory. The compiler seems to be using the right address but looking in the wrong memory block. I believe the compiler should automatically use the correct address as XC8 does not seem to have a ROM type/command like XC16. I have tried several variant of this code with arrays, pointers, statics , const and normal char without success. I have used similar code on other systems, so I am thinking that it is more likely to be the compiler options or development environment.
Thanks
Paul