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 support@ccsinfo.com

Eeprom inserting data using #ROM

 
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

Eeprom inserting data using #ROM
PostPosted: Thu Oct 27, 2005 11:22 am     Reply with quote

Hello everyone,

I have a question that is more MPLAB IDE related then CCS, but since all the competent people gather in this forum anyway, Ill give it a try on the message board.

I am trying to use the #ROM command to preset data in the eeprom. However, I have found something disturbing (disturbing because I cannot make sense out of it, but there is surely an explanation I just don't see it)
The hardware is a PIC 18F4680.

The eepromadress is located in 0xF0000-F003FF.

Now, the function works just fine. Data is inserted into the hexfile correctly and MPLAB updates the eeprom as it should.

But, when I examine the HEX-file I find NO difference between the format for the Flashdata at 0-3ff and the eeprom data at f0000-f003ff.

Example:
:1001900000F0A1BE04EF0BF00F50006E1050016E86 //This is FLASH data.
///LOTS OF LINES HERE////

:100190001800000000000000000000000000000047 //This is EEPROM data.

The lines start exactly the same?? Now, HOW can MPLAB know which line is eeprom and which is flash data? (I will be using the HEX file for purposes other than just programming the PIC, so I will need to know how to distinguish between the two)

//Daniel.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 27, 2005 11:38 am     Reply with quote

Compile a test program:
Code:
#include <18F4680.H>
#fuses XT, NOWDT, NOPROTECT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

#ROM 0x300 = {1,2,3}
#ROM 0xF0300 = {4,5,6}

void main()
{

while(1);
}


Here is the HEX file:
Quote:

:020000040000FA
:1000000002EF00F0F86AD09EEA6AE96AC150C00BBC
:0C0010000F09C16E070EB46EFFD703008D
:06030000010002000300F1
:02000004000FEB
:06030000040005000600E8
:020000040030CA
:0E00000000011E1E008281000FC00FE00F40A5
:00000001FF
;PIC18F4680


Kiel has a good page on HEX files. Read the section
on Extended Linear Address Records.
http://www.keil.com/support/docs/1584.htm
d00dajo



Joined: 20 Jul 2004
Posts: 34

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

PostPosted: Thu Oct 27, 2005 12:05 pm     Reply with quote

Quote:

:020000040000FA
:1000000002EF00F0F86AD09EEA6AE96AC150C00BBC
:0C0010000F09C16E070EB46EFFD703008D
:06030000010002000300F1
:02000004000FEB
:06030000040005000600E8
:020000040030CA
:0E00000000011E1E008281000FC00FE00F40A5
:00000001FF
;PIC18F4680


Thanks PCM programmer,
I really did look at the 02 lines, but I looked at the first byte.
Of course the base adress is given in that record. Reading the textfile lineraly, the application will need to remember the last "base adress" set and calculate an offset.

//DJ
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