View previous topic :: View next topic |
Author |
Message |
heliodoro.alegre
Joined: 20 Nov 2013 Posts: 6
|
read_eeprom malfunction |
Posted: Tue Nov 26, 2013 3:19 am |
|
|
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
|
same problem |
Posted: Wed Aug 06, 2014 7:53 am |
|
|
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: 9241 Location: Greensville,Ontario
|
|
Posted: Wed Aug 06, 2014 8:11 am |
|
|
post your complete program as it could be your print function...
hth
jay |
|
|
overmindx
Joined: 06 Oct 2008 Posts: 43
|
|
Posted: Wed Aug 06, 2014 8:31 am |
|
|
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 |
|
|
|