Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Jul 06, 2024 2:44 am |
|
|
A search here would find a lot about this.
You have a very old compiler. A method to do this was fixed in the modern
compilers. but the key is to understand the PIC, and read the manual.
In the PIC, the ROM, and RAM are two completely separate memory spaces.
So "CAL" as a constant, is stored in the ROM, and cannot be used inside
a string operation needing a RAM pointer. You can strcpy this value into
a RAM array to do the comparison.
If you read the manual section on strcmp, for your compiler, it says:
Quote: |
s1 and s2 are pointers to an array of characters (or the name of an array). Note that s1 and s2 MAY NOT BE A CONSTANT (like "hi").
|
The note is critical.
Modern compilers can virtualise a constant like this by copying it into
a tiny temporary buffer. Uses a compiler setting 'PASS_STRINGS =
IN_RAM".
For your compiler, you have to do this yourself. |
|