View previous topic :: View next topic |
Author |
Message |
ferrarilib
Joined: 11 Jun 2005 Posts: 38
|
Buffering Read EEprom |
Posted: Sat Jun 24, 2006 4:47 am |
|
|
in my program i am reading data from EEprom 24c32 whith this routine
count =0;
for(INDEX=0x1A; Buff[count]==0x00; INDEX++)
{
Buff[count]=read_ext_eeprom(INDEX);
count++;
}
where Buff is array 6a long.
my problem is :
in eprom i have 0x33,0x33,0x00,0xCC,0xCD,0x00,0x30,0x30.....ecc
i use 0x00 for stop read .
But when i read the data don't stop when ther is 0x00 !
can sameone help me ?
THANKS |
|
|
epideath
Joined: 07 Jun 2006 Posts: 47
|
|
Posted: Sat Jun 24, 2006 8:03 am |
|
|
It is because you are checking the Buff[count] after you have incremented count. so it is always pointing at an invalid point.
try something like this instead:
Code: |
INDEX = 0x1A;
count = 0;
do {
Buff[count] = read_ext_eeprom(INDEX++);
while(Buff[count++] != 0x00);
|
Hope this helps. |
|
|
ferrarilib
Joined: 11 Jun 2005 Posts: 38
|
|
Posted: Sat Jun 24, 2006 8:54 am |
|
|
THANKS !
I havent look this .
Thanks really
now works fine. |
|
|
|