View previous topic :: View next topic |
Author |
Message |
Guest
|
EPROM starting address |
Posted: Thu Jul 08, 2004 1:49 pm |
|
|
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
|
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Jul 08, 2004 2:45 pm |
|
|
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
|
|
Posted: Fri Jul 09, 2004 7:32 am |
|
|
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
|
|
Posted: Fri Jul 09, 2004 9:12 am |
|
|
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 |
|
|
|