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 support@ccsinfo.com

internal eeprom 16f876

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







internal eeprom 16f876
PostPosted: Sat May 10, 2003 1:40 am     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: internal eeprom 16f876
PostPosted: Sun May 11, 2003 3:21 pm     Reply with quote

:= 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
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