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

Adresses for PICs internally eeprom?

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



Joined: 09 May 2005
Posts: 1

View user's profile Send private message

Adresses for PICs internally eeprom?
PostPosted: Mon May 09, 2005 4:03 am     Reply with quote

Hello, i am writing to the PIC 18f458 internally eeprom. Im using this code:

Code:

write_eeprom(0,'A');
write_eeprom(1,'B');


I wonder, the first number 0, 1 i understand is the adress in the memory, but one thing i dont under stand, my pic have 256 bytes of eeprom, is 0 the first byte, the 1 the second byte ..... ???

My problem is if i write:

Code:

write_eeprom(0,'A');
write_eeprom(1,'B');
write_eeprom(300,'C'); 


Am i writing to the 301 byte then, but this seem to be strange because i have only 256 bytes of eeprom.

But everything work when i write and the read from the eeprom and sends the data to hyperterminal via RS232.

Is there something here i have misunderstood?

Can anyone explain this thing for me?

Best (beginner) regards /Stekarn
valemike
Guest







PostPosted: Mon May 09, 2005 6:24 am     Reply with quote

When you write to location 300, perhaps you're actually wrapping around and writing to: 300 - 255 = 45. Who knows.

I'm not sure on the internals on this. Just make sure you don't write to anything else past 255!
stekarn



Joined: 09 May 2005
Posts: 1

View user's profile Send private message

PostPosted: Tue May 10, 2005 2:25 am     Reply with quote

But wouldnt the compiler give me an error message if i try to write outside the eeprom memory adresses?
valemike
Guest







PostPosted: Tue May 10, 2005 6:42 am     Reply with quote

If your program compiles just fine, then obviously you're not getting flagged with an error nor warning.

Register EEADR is an 8-bit register.

Similiarly, you may or may not be flagged if you attempt the following assignment:

int x;
...
x= 300;

The 300 is simply truncated when you try to put it in x.
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