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

EPROM starting address

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








EPROM starting address
PostPosted: Thu Jul 08, 2004 1:49 pm     Reply with quote

I am having trouble determining the EPROM starting address in a PIC 16F876. I am looking at the datasheet, but am not positive which info represents this value.

Thanx.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jul 08, 2004 1:57 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=19337
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Jul 08, 2004 2:45 pm     Reply with quote

If you simply want to use the built in functions, while the PIC is running, then you can use the write_eeprom() function. This would be:

write_eeprom(address, value);

where address is 0x00 to 0xFF (0 - 255)
and value is any 8bit variable or number.

example:

write_eeprom(0x00, 10); Store the value of 10 at address 0.

Ronald
Guest








PostPosted: Fri Jul 09, 2004 7:32 am     Reply with quote

if I have to write data like "hello3.75", "hello5.87",
write_eeprom(0x00, "hello3.75");
write_eeprom(0xa0,"hello5.87");

in the future if I want to read the data in the eeprom like the above is it like
char data[2][10];
read_eeprom(0x00,data[0]);
read_eeprom(0xa0,data[1]);

right?
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Fri Jul 09, 2004 9:12 am     Reply with quote

You can't write 'strings' to the eeprom using the write_eeprom() command. You have to write each address on at a time, as far as I know. So, you would have to do something like this:

write_eeprom(0x00, 0x68); // hex for the letter 'h'
write_eeprom(0x01, 0x65); // hex for the letter 'e'
write_eeprom(0x02, 0x6C); // hex for the letter 'l'
and so on.....

and when you want to READ the eeprom you need to each location, one at a time.

variable = read_eeprom(0x00);
variable = variable << 1 | read_eeprom(0x01);// shift left one and stick the new character in the LSB spot.
variable = variable << 1 | read_eeprom(0x02);// do it again

You could make the Read part a loop to read the entire data area if you wanted. From what I've seen, this is how it would need to be done. I'm not completely sure if you can write or read and entire array like you want to but I would doubt it.

Ronald
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