|
|
View previous topic :: View next topic |
Author |
Message |
Blob
Joined: 02 Jan 2006 Posts: 75 Location: Neeroeteren, Limburg, Belgium
|
PIC18F242 to 2420 migration => writing eeprom |
Posted: Tue Mar 21, 2006 5:27 am |
|
|
Good afternoon everyone,
I have a C program running on a PIC18F242. Following our supplier, it is not recommended for new designs.
This and the fact that they become more expensive then the PIC18F2420, made us decide to change.
I use MPLab, CCS compiler.
Compiling my old program for the new PIC, gave me some errors.
First some Fuse-bits, I changed them in the correct names.
only, I am not sure of one: NOOSCEN. I changed into NOIESO, but I'm not sure if this is correct.
secondly, erase_program_eeprom is not supported by PIC18F2420. So I assume it automatically erases when I perform a write-command. (this I am not sure)
Compiling and programming works.
I use the correct #include-file and I select the correct device in the device-list.
But when I send some data to the eeprom with serial connection, it seems not to write the data to the eeprom. It does however receive the data, because I use a handshake protocol.
Has someone any idea about what can be wrong?
Thanks in advance,
Blob,
Belgium |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 21, 2006 7:30 am |
|
|
Use NOIESO, NOFCMEN. This turns off all clock oscillator switching.
What makes you say 'erase_program_eeprom' is not supported on the 2420?...
It is.
If you have one of the latest compilers, look at the manual entry for 'write_program_memory'. This explains the difference between this function (which will automatically erase, if you write to the first byte of a block), and the write_program_eeprom function.
On this chip, the program memory write size, and erase size are the same, so erasing should be automatic in normal circumstances.
Best Wishes |
|
|
Blob
Joined: 02 Jan 2006 Posts: 75 Location: Neeroeteren, Limburg, Belgium
|
|
Posted: Tue Mar 21, 2006 7:42 am |
|
|
Ttelmah wrote: |
What makes you say 'erase_program_eeprom' is not supported on the 2420?...
|
Sure it is possible to errase the program eeprom. But the function above is not recognised in compilation. It is automatically erased when i perform a write action.
I also used NOFCMEN, but it still does not work...
can it be something with the write_program_eeprom function?
I suppose it automatically cleares the EEIF interrupt flag bit PIR2<4>??
greets,
Blob |
|
|
|
|
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
|