CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

#ROM for PIC24FJ128GA306

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

#ROM for PIC24FJ128GA306
PostPosted: Sat Feb 20, 2016 9:41 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Feb 20, 2016 11:05 pm     Reply with quote

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=47777
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Sun Feb 21, 2016 1:41 am     Reply with quote

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

View user's profile Send private message

Thanks and a question about serial numbering using string
PostPosted: Sun Feb 21, 2016 9:56 am     Reply with quote

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: 19540

View user's profile Send private message

PostPosted: Sun Feb 21, 2016 11:47 am     Reply with quote

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

View user's profile Send private message

Thanks
PostPosted: Sun Feb 21, 2016 1:50 pm     Reply with quote

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

View user's profile Send private message

Will be fixed in next release
PostPosted: Sun Feb 28, 2016 10:23 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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