View previous topic :: View next topic |
Author |
Message |
YUM
Joined: 27 May 2004 Posts: 12 Location: Austria
|
INIT eeprom with int32 values (#ROM INT32 adr=.....) |
Posted: Wed Jun 25, 2008 1:52 am |
|
|
hello,
i think the title say it all:
i want to initialize the eeprom with int32 data, without splitting the 4 - byte data by hand before.
#rom int32 adr = { does not work.
someone in the forum is speaking of a
GET_EEPROM function. so is there a SET_EEPROM as well?
thank you for your help.[/b] |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jun 25, 2008 11:29 am |
|
|
Do you want to put the values in "data eeprom" or in "flash program memory" ? Look in the PIC data sheet to understand the difference
between these two types of memory.
Also, what PIC are you using ? |
|
![](templates/subSilver/images/spacer.gif) |
YUM
Joined: 27 May 2004 Posts: 12 Location: Austria
|
|
Posted: Thu Jun 26, 2008 12:48 am |
|
|
good morning!
i use:
PIC16F877A and data eeprom (256 bytes, starting at address 0x2100)
compiler ver. 3.227 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 26, 2008 1:33 am |
|
|
You could invent a macro to split up the int32 into individual bytes.
Example:
Code: | #include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#define Split(x) x >> 24, x >> 16, x >> 8, x
#rom 0x2100 = {Split(0x01234567), Split(0x89ABCDEF) }
//====================================
void main()
{
while(1);
} |
This gives the following result in the eeprom window in MPLAB:
Code: | 0000 01 23 45 67 89 AB CD EF FF FF FF FF FF FF FF FF |
|
|
![](templates/subSilver/images/spacer.gif) |
YUM
Joined: 27 May 2004 Posts: 12 Location: Austria
|
|
Posted: Thu Jun 26, 2008 3:40 am |
|
|
thank you, PCM Programmer, this is feasible, though there does not seem to be a direct way to do it.
yum |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Wed Jul 23, 2008 12:05 am |
|
|
Just for information, the PIC16F88's data eeprom starts at address 0x2100 as well.
#rom 0x2100={1,2,3,4,5,6,7,8,9,0} // fills the start of the EEPROM space with said numbers |
|
![](templates/subSilver/images/spacer.gif) |
|