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

#rom EEprom data

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







#rom EEprom data
PostPosted: Tue Feb 04, 2003 10:22 am     Reply with quote

I am porting an application from 16F876 to 18F252.
On the '876 with word addresses to 0x1fff I used
#rom 0x2100 = {...}
to program ee data at same time as code in flash. Worked ok.
Anyone know what I should use for '252 (with byte addresses to 0x7fff)?
I've tried
#rom 0x4100 = {...}
and
#rom 0x8100 = {...}
___________________________
This message was ported from CCS's old forum
Original Post ID: 11268
TSchultz



Joined: 08 Sep 2003
Posts: 66
Location: Toronto, Canada

View user's profile Send private message

RE: #rom EEprom data
PostPosted: Tue Feb 04, 2003 11:34 am     Reply with quote

:=I am porting an application from 16F876 to 18F252.
:=On the '876 with word addresses to 0x1fff I used
:= #rom 0x2100 = {...}
:=to program ee data at same time as code in flash. Worked ok.
:=Anyone know what I should use for '252 (with byte addresses to 0x7fff)?
:=I've tried
:= #rom 0x4100 = {...}
:=and
:= #rom 0x8100 = {...}

#rom 0xF00000 = { ... }

This would be the first byte of the EEPROM.

One thing I found when I was converting a recent project from a PIC16F877 to a PIC18F452 was a small issue with data stored in the EERPOM this way. The data is stored as a 16 bit word and ordered in little endian instead of big endian.

For example;
In the 16 series
#rom 0x2100 = { 0x01, 0x055 }
results in EEPROM byte 0 having 0x01 and byte 1 having 0x55.

In the 18 series
#rom 0xF00000 { 0x01, 0x55 }
results in EEPROM byte 0 having 0x01, byte 1 having 0x00, byte 2 having 0x55, and byte 4 having 0x00.

The I tried;
#rom 0xF00000 { 0x0155 }
results in EEPROM byte 0 having 0x55 and byte 1 having 0x01

So I finally used
#rom 0xF00000 { 0x01 }
#rom 0xF00001 { 0x55 }
This resulted in the behavour I wanted, the same as found in the 16 series.

Even when doing this make sure that you store the entries in the EEPROM in ascending order as each byte will actually store 16 bits.

This was the behaviour I found with PCH versions 3.129 to 3.135, I have not yet tried the later versions but expect they will do the same.

-Troy
___________________________
This message was ported from CCS's old forum
Original Post ID: 11273
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