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

How can I write a string on eeprom?

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



Joined: 25 Jan 2010
Posts: 35

View user's profile Send private message MSN Messenger

How can I write a string on eeprom?
PostPosted: Mon Feb 22, 2010 12:51 pm     Reply with quote

Hi everyone. I want to write a string on eeprom, then print that data on
an lcd, but I dont know how to do. I want to write:
Quote:

M929 y-4/1
B:||||

also combinations like this. But these writings are not variables, only
writings for several cases. (e.g if x=1 print M929 , if x=2 print M939....).
Should the data to be written on eeprom be variables? I tried to use:
Code:

lcd_init();

lcd_gotoxy(1,1);
write_eeprom(0, M929);
printf(lcd_putc, read_eeprom(0));

lcd_gotoxy(6,1);
write_eeprom(1, y-4/1);
printf(lcd_putc, read_eeprom(1));

lcd_gotoxy(1,2);
write_eeprom(2, B:||||);
printf(lcd_putc, read_eeprom(2));

But it does not work. Can anyone correct me or give me an advice to
write a string on eeprom and that shows it on an lcd. If there is an
example code, please share with me.

There is also one more question, I don't know how many bytes are used
by a string. I have 20 writings like above and I use 16f876 which has 256
bytes eeprom. Is this memory enough for this job?
_________________
compiler version: 4.105
pic: 16f876
clock frequency: 4MHz
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 22, 2010 4:51 pm     Reply with quote

Do you need to write to the eeprom at run-time with write_eeprom()
(as shown in your code) ? If so, this thread has sample code:
http://www.ccsinfo.com/forum/viewtopic.php?t=29309

Or, do you only need to put the strings into eeprom when the PIC is
programmed by the ICD programmer ? Then you can use the #rom
statement to put the strings into eeprom.
memoally



Joined: 25 Jan 2010
Posts: 35

View user's profile Send private message MSN Messenger

PostPosted: Tue Feb 23, 2010 4:47 pm     Reply with quote

Sorry for late answer and also thank you, pcm programmer. It was not mandatory to use eeprom but I think it was the best choice for the work. Anyway, I solved the problem by using alternative ways Smile Thank you again...
_________________
compiler version: 4.105
pic: 16f876
clock frequency: 4MHz
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