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 support@ccsinfo.com

PIC18F242 to 2420 migration => writing eeprom

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



Joined: 02 Jan 2006
Posts: 75
Location: Neeroeteren, Limburg, Belgium

View user's profile Send private message

PIC18F242 to 2420 migration => writing eeprom
PostPosted: Tue Mar 21, 2006 5:27 am     Reply with quote

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







PostPosted: Tue Mar 21, 2006 7:30 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Mar 21, 2006 7:42 am     Reply with quote

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
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