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 CCS Technical Support

How can I transfer the data of the rom to the eeprom?

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



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

How can I transfer the data of the rom to the eeprom?
PostPosted: Wed Nov 04, 2009 3:00 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 04, 2009 3:48 pm     Reply with quote

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);
}
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