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

Buffering Read EEprom

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



Joined: 11 Jun 2005
Posts: 38

View user's profile Send private message

Buffering Read EEprom
PostPosted: Sat Jun 24, 2006 4:47 am     Reply with quote

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 Smile
epideath



Joined: 07 Jun 2006
Posts: 47

View user's profile Send private message

PostPosted: Sat Jun 24, 2006 8:03 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Jun 24, 2006 8:54 am     Reply with quote

Very Happy
THANKS !
I havent look this .
Thanks really
now works fine.
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