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

read_eeprom malfunction

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



Joined: 20 Nov 2013
Posts: 6

View user's profile Send private message

read_eeprom malfunction
PostPosted: Tue Nov 26, 2013 3:19 am     Reply with quote

I am using the eeprom functions with a PIC18F67K22
and compiler version 4.114

write_eeprom function works, but read_eeprom not

read_eeprom returns last value written, or 0 if no
write_eeprom has been made.
It seems read_eeprom does not change EEDATA
register value.

If i make
write_eeprom (5, 30);

x = read_eeprom (0);
x value is 30

x= read_eeprom(100);
x values is 30

x = read_eeprom(anywhere);
x values is 30

If i make
write_eeprom (0, 10);

x = read_eeprom (0);
x value is 10

x= read_eeprom(100);
x values is 10

x = read_eeprom(anywhere);
x values is 10



Is any known bug in read_eeprom for this device or
compiler version?
overmindx



Joined: 06 Oct 2008
Posts: 43

View user's profile Send private message

same problem
PostPosted: Wed Aug 06, 2014 7:53 am     Reply with quote

hi,
have you solved this? i have the exact same problem. i used the same chip as you do and same compiler version and it does exactly like you said. the last character that i write on any address seems to be written to all addresses. can anybody confirm if this is a bug or is there something that we have missed? thanks
temtronic



Joined: 01 Jul 2010
Posts: 9162
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Aug 06, 2014 8:11 am     Reply with quote

post your complete program as it could be your print function...

hth
jay
overmindx



Joined: 06 Oct 2008
Posts: 43

View user's profile Send private message

PostPosted: Wed Aug 06, 2014 8:31 am     Reply with quote

Code:


void newEEData(char *eedata, unsigned int16 hbp)
{
   unsigned int16 zzx=0;
   int dataFinder=0;
   unsigned int16 NewDataLoc=0;
   char chx;
   
   NewDataLoc = strlen(eedata) + hbp;
   for (zzx=hbp;zzx<NewDataLoc;zzx++)
   {
      write_eeprom(zzx,eedata[dataFinder++]);
   }   

 for(zzx=hbp;zzx<=(NewDataLoc+1);zzx++)
   {
      chx = read_eeprom(zzx);
      fprintf(PC,"chx=%c\n",chx);
   }
   
}

------------------------
char strx[15]={};

strcpy(strx,"testing");
newEEData(strx, 100);



this would print:
chx=g
chx=g
chx=g
chx=g
chx=g
chx=g
chx=g
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