![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Einly Guest
|
internal eeprom 16f876 |
Posted: Sat May 10, 2003 1:40 am |
|
|
Dear all,
I am trying to write and read from the internal eeprom of pic 16f876 with the following code:
#include <16f876.h>
#fuses hs,nowdt,noprotect,put,brownout,nolvp
#include <lcd.c>
#byte portc=7
void main()
{
char c;
set_tris_c(0);
lcd_init();
write_eeprom(0,'A');
c=read_eeprom(0);
lcd_putc(c);
delay_ms(1000);
}
It works ok. When I changed to write_eeprom(256,'B', I still able to read B on the LCD. However, from what I read, the address is only from 0x255, why I still able to read when I wrote 256, or ever 1000 in the add part?
Thanks in advance:-)
___________________________
This message was ported from CCS's old forum
Original Post ID: 14336 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: internal eeprom 16f876 |
Posted: Sun May 11, 2003 3:21 pm |
|
|
:= write_eeprom(0,'A');
:= c=read_eeprom(0);
:=It works ok. When I changed to write_eeprom(256,'B', I still able to read B on the LCD. However, from what I read, the address is only from 0x255, why I still able to read when I wrote 256, or ever 1000 in the add part?
-------------------------------------------------------------
The valid address range is from 0x00 to 0xFF. If you try
to use a larger address value, such as 0x100 (256), the
compiler will only use the lower 8 bits. So if you use 0x100,
the compiler converts it to 0x00 when the code is compiled.
___________________________
This message was ported from CCS's old forum
Original Post ID: 14362 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|