|
|
View previous topic :: View next topic |
Author |
Message |
Imanjl
Joined: 15 Nov 2004 Posts: 42
|
18f452 EEPROM Address ? |
Posted: Fri Oct 19, 2007 4:21 am |
|
|
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
|
|
Posted: Fri Oct 19, 2007 4:53 am |
|
|
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
|
|
Posted: Fri Oct 19, 2007 8:00 am |
|
|
Thanks alot for your helpful info...I put (#ROM int8 0xF00000) into my code and It works Now ... . |
|
|
|
|
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
|