View previous topic :: View next topic |
Author |
Message |
pilar
Joined: 30 Jan 2008 Posts: 197
|
How can I transfer the data of the rom to the eeprom? |
Posted: Wed Nov 04, 2009 3:00 pm |
|
|
Hi, I want to move the data of the rom to the eeprom of a pic18f452, what is my mistake?
Code: | #include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay(clock=20000000)
int i;
#define ROMDATA 0x7FA0
#ROM int8 ROMDATA={"123044"}
void main(){
for (i = 0 ; i<6 ; i++){
write_eeprom(i,ROMDATA[i]);
}
while (true);
} |
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Nov 04, 2009 3:48 pm |
|
|
This should do it: Code: | #include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay(clock=20000000)
#define ROMDATA 0x7FA0
#ROM int8 ROMDATA={"123044"}
void main()
{
int8 i;
int8 data;
for (i = 0 ; i<6 ; i++)
{
data = read_program_eeprom(ROMDATA + i);
write_eeprom(i, data);
}
while (true);
} |
|
|
|
|
|
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
|