View previous topic :: View next topic |
Author |
Message |
gael
Joined: 08 Jan 2005 Posts: 7
|
EEDATA memory question |
Posted: Mon Jan 10, 2005 1:35 pm |
|
|
I need to write 0xFF to the last address of data memory. I am using a PIC18F452.
What is that address for this chip.
And, another question, which function should I use: WRITE_PROGRAM_EEPROM or WRITE_EEPROM ??? |
|
|
garyzheng
Joined: 22 Jul 2004 Posts: 25
|
i think you can try write_prgramme_eeprom |
Posted: Mon Jan 10, 2005 1:48 pm |
|
|
i used this command before. it can work:)
but you should know where your program memory is empty? don't occupy the place where the program is:) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 10, 2005 1:54 pm |
|
|
There are two ways to do it. You can use a #rom statement,
or you can use the write_eeprom() function, as shown in the
program below.
Code: | #include <18F452.h>
#fuses XT,PROTECT,PUT,BROWNOUT,NOLVP,NOWDT
#use delay(clock=4000000)
// This method sets the last byte of data eeprom = 0xFF
// in the HEX file. The data eeprom will be set to 0xFF
// when the PIC is programmed with the ICD2, PicStart-Plus, etc.
// Notes:
// The base address of data eeprom is 0xF00000 for the 18F452.
// There are 256 bytes of data eeprom, so the address of the
// last byte is 0xF00000 + 0xFF = 0xF000FF.
#rom 0xF000FF = { 0xFF }
//===================
void main()
{
// This method writes 0xFF to the last byte of data eeprom
// when your program is running. (ie., at "run time").
write_eeprom(0xFF, 0xFF); // address, data
while(1);
} |
|
|
|
|