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

Inserting EEprom data into the hex file

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



Joined: 20 Jul 2004
Posts: 34

View user's profile Send private message Send e-mail

Inserting EEprom data into the hex file
PostPosted: Thu Sep 29, 2005 10:59 am     Reply with quote

Hi all,

Reading up in the CCS manual, it states that the #rom command can be used to insert data into the hex. Now, I know how to use the #rom to insert data into the program memory. But can I insert EEprom data as well? So that MPLAB will automatically set the eeprom locations to certain data when loading/importing the hex file. The microcontroller in question is the PIC18F4680, with 64 kBytes of ram, so the entire adress space (0x0000-0xFFFF) is used for program memory.

In the manual it states "Purpose:
Allows the insertion of data into the .HEX file. In particular, this may be used to program the '84 data EEPROM, as shown in the following example.
Note that if the #ROM address is inside the program memory space, the directive creates a segment for the data, resulting in an error if a #ORG is over the same area. The #ROM data will also be counted as used program memory space.
Examples:
#rom 0x2100={1,2,3,4,5,6,7,8}
"

Now, the example with #rom 0x2100 does not really clarify how this "eeprom insertion" should work. Im imagining that the eeprom in question in the example is something from some old 16F uC with a program memory address space of <0x2100 and the data eeprom located in adress range 0x2100->upwards. Since the 18F4680 has 64k of memory and the eeprom is not inside regular adress space, I suspect that I cannot use this function to force values into MPLAB.

Anyone who knows how to make the forced insertion?

//DJ
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Thu Sep 29, 2005 11:11 am     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=22359&highlight=rom+18f
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Sep 29, 2005 11:18 am     Reply with quote

Here is an example of populating the EEPROM in a PIC18F452.

Code:

// Define the internal EEPROM  offsets for the calibration coefficients
#define EEPROM   0xf00000

// define the calibration coefficients
#rom EEPROM + E_SerialNbr    = {0xff}
#rom EEPROM + E_Window     = {40}
#rom EEPROM + E_P0_offset     = {0x0000}   // offset adjustment RTD 1


MPLAB has no problem with this. The intel hex file format supports expended addresses via the type 4 record.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
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