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

EEPROM read

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



Joined: 01 Sep 2009
Posts: 10
Location: Malaysia

View user's profile Send private message

EEPROM read
PostPosted: Tue Jan 12, 2010 11:32 am     Reply with quote

Code:
//FRONT SENSOR DETECTION ALGORITHM
      set_adc_channel(0);
      delay_us(20);
      val1=read_adc();
      delay_us(20);
      read_eeprom(0x2100);
      delay_ms(200);
     
      if (val1<vref)
      {
      write_eeprom(0x2100,val1);
      delay_ms(200);
      }
     
      F1=read_eeprom(0x2100);
      delay_ms(50);
     
      while (TXIF == 0);
      TXREG = printf("%2x", F1);
      TXREG = printf("\r\n");
      delay_ms(10);


Hello guys, i am having some problem to read the data at EEPROM. I have send the "F1" value by using RS232 communication, but i'm get "0" as an output at the hyperterminal. Is there any problem with my read code. Hopefully u guys will help me.
_________________
CCS Version: 4.038
Current project: Obstacle detection robot
mkuang



Joined: 14 Dec 2007
Posts: 257

View user's profile Send private message Send e-mail

PostPosted: Tue Jan 12, 2010 11:38 am     Reply with quote

Which PIC do you have?

Code:

write_eeprom(0x2100,val1);


0x2100 is an awfully large EEPROM address. You sure your EEPROM is that big?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 12, 2010 11:45 am     Reply with quote

Quote:

write_eeprom(0x2100,val1);
delay_ms(200);
}

F1=read_eeprom(0x2100);
delay_ms(50);

Read this thread about using the correct address range for the eeprom
functions:
http://www.ccsinfo.com/forum/viewtopic.php?t=38322&highlight=0x2100
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