|
|
View previous topic :: View next topic |
Author |
Message |
soonc
Joined: 03 Dec 2013 Posts: 215
|
#ROM for PIC24FJ128GA306 |
Posted: Sat Feb 20, 2016 9:41 pm |
|
|
I need to use the #rom statement to set about 10 values required for first time power ON.
What is the best address to ensure I'm not clobbering something ?
How can I tell what the compiler is using ?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19541
|
|
Posted: Sun Feb 21, 2016 1:41 am |
|
|
As a comment though, why not just declare the variables as const?.
Assuming you are compiling in CCS mode, not ANSI, then these are stored in ROM, and the memory space is reserved for you.
I have in one program here, two large structures. One declared as a ram variable, and a duplicate (with the name followed by _default), declared as a const, with all the values 'filled in'. This system also has an external EEPROM, that stores the 'real' values from a calibrated/running system.
On boot, the system checks if the external EEPROM contains values, and if these are legitimate (checksum). If so, the RAM variable is loaded with these. If not, the const variable is copied into RAM, to give an initial 'default' behaviour. |
|
|
soonc
Joined: 03 Dec 2013 Posts: 215
|
Thanks and a question about serial numbering using string |
Posted: Sun Feb 21, 2016 9:56 am |
|
|
Ttelmah wrote: | As a comment though, why not just declare the variables as const?.
Assuming you are compiling in CCS mode, not ANSI, then these are stored in ROM, and the memory space is reserved for you.
I have in one program here, two large structures. One declared as a ram variable, and a duplicate (with the name followed by _default), declared as a const, with all the values 'filled in'. This system also has an external EEPROM, that stores the 'real' values from a calibrated/running system.
On boot, the system checks if the external EEPROM contains values, and if these are legitimate (checksum). If so, the RAM variable is loaded with these. If not, the const variable is copied into RAM, to give an initial 'default' behaviour. |
Thanks for all replies.
I now have a solution and using const is the way to go, that leaves me free and the compiler can handle where it places it.
PCHWD V5.055
Code: | const char SerialNumber[5]={"1234"};
#serialize(id=SerialNumber,string=4,next="1234",prompt="Enter Serial number",log="SerialNumbers.txt" ) |
The data entry dialog displays 1234 and entering 5678 when the string is printed the number is 5684 ! I expected the number to be 5678.
In the debugger SerialNumber[] is 1234 but the debugger does not ask for a Serial Number so I have to assume the ccsload program is not placing the entered text into the rom array correctly before it programs the chip.
Has anyone else seen this problem ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19541
|
|
Posted: Sun Feb 21, 2016 11:47 am |
|
|
Only thing obviously 'wrong', is using string=x. This is only used when the data is to be stored into EEPROM.
The three parameters 'dataee', 'binary', and 'string', are used _instead_ of ID.
May be causing a problem. |
|
|
soonc
Joined: 03 Dec 2013 Posts: 215
|
Thanks |
Posted: Sun Feb 21, 2016 1:50 pm |
|
|
Ttelmah wrote: | Only thing obviously 'wrong', is using string=x. This is only used when the data is to be stored into EEPROM.
The three parameters 'dataee', 'binary', and 'string', are used _instead_ of ID.
May be causing a problem. |
Yes I see the error. I'll play around with the other options.
Thanks again |
|
|
soonc
Joined: 03 Dec 2013 Posts: 215
|
Will be fixed in next release |
Posted: Sun Feb 28, 2016 10:23 am |
|
|
Ttelmah wrote: | Only thing obviously 'wrong', is using string=x. This is only used when the data is to be stored into EEPROM.
The three parameters 'dataee', 'binary', and 'string', are used _instead_ of ID.
May be causing a problem. |
Tech support confirmed the problem is in the compiler and should be fixed with next release. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|