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

16f873A eeprom error

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



Joined: 07 Jul 2011
Posts: 5
Location: kochi

View user's profile Send private message

16f873A eeprom error
PostPosted: Wed Nov 02, 2011 3:52 am     Reply with quote

Hello sir, I am using pic16f873a eeprom to store value. In ccs compiler I write program like this
Code:

ROM 0x2100={35,27}

hc=read_eeprom(0);
lc=read_eeprom(1);
to read eeprom


write_eeprom(0,hc);
write_eeprom(1,lc);
to write eeprom

When i complete one cycle of this operation, i am not able to read the lc value, but no problem eith reading of hc.
Can anybody point out what is the problem with this program. Thanks in advance.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Nov 02, 2011 4:37 am     Reply with quote

Since you don't post a program, not much we can say!.....

However:
Code:

#include <16F873A.h>
#FUSES NOWDT,HS,NOBROWNOUT,PUT,NOLVP

#use delay(clock=20000000)
#use RS232 (UART1,BAUD=9600,ERRORS)

#ROM 0x2100={35,27}

void main() {
   int8 hc,lc;
   hc=read_eeprom(0);
   lc=read_eeprom(1);
   printf("hc= %3d lc=%3d\n\r",hc,lc);
   do {
   } 
   while (TRUE);
}


Happily displays:
Code:

hc=  35 lc= 27


You need to look at details. For instance, the ROM statement, is #ROM, not ROM as you post. Remember also, (you don't show how you are using them), what might have changed variables, so they don't do what you expect.

Best Wishes
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