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

18f452 EEPROM Address ?

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



Joined: 15 Nov 2004
Posts: 42

View user's profile Send private message Send e-mail Yahoo Messenger

18f452 EEPROM Address ?
PostPosted: Fri Oct 19, 2007 4:21 am     Reply with quote

Hi

I want to write some data to internal EEPROM of 18f452 during programming the chip .I used to put a Pre-processor directive before the Main for 16f877A Mcu: #ROM 0x2100 {0,1,2,3,...,} .

But it doesnt work for 18f part 0x2100 is somewhere in the program memory space . we know that program memory starts from 0x0000 and ends at 0x7FFF

Does anyone know the address for internal EEPROM of 18f452 ?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Oct 19, 2007 4:53 am     Reply with quote

The EEPROM has a seperate address range in the PIC, you can't normally address it. It is only in the HEX file that the EEPROM is mapped onto the PIC's program address space.

From the PIC18 Programming Specification, Chapter 5.6
Quote:
When embedding data EEPROM information in the HEX file, it should start at address F00000h.


Another difference is that the PIC16 writes the EEPROM in bytes while the PIC18 writes words by default. Fix this by adding a type specifier to the #ROM line.
Code:
// Example to set words:
//   #ROM 0xF00000 = {1, 2, 3, 4, 5}    // writes 1,0, 2,0, 3,0, 4,0
// Example to set bytes:
//   #ROM int8 0xF00000 = {1, 2, 3, 4, 5}   // this is same behavior as PIC16
// Example to set a string of bytes:
//   #ROM 0xF00010 = {"12345"}
Imanjl



Joined: 15 Nov 2004
Posts: 42

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Fri Oct 19, 2007 8:00 am     Reply with quote

Thanks alot for your helpful info...I put (#ROM int8 0xF00000) into my code and It works Now ... .
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