TSchultz
Joined: 08 Sep 2003 Posts: 66 Location: Toronto, Canada
|
RE: #rom EEprom data |
Posted: Tue Feb 04, 2003 11:34 am |
|
|
:=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 |
|