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

How to write the PIC16F877 code to EEPROM?

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



Joined: 12 Aug 2007
Posts: 41

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

How to write the PIC16F877 code to EEPROM?
PostPosted: Fri Nov 09, 2007 2:40 pm     Reply with quote

Hi,

I wrote the code for PIC16F877. But, there is no place in PIC16F877 anymore... So, I want to write the code, that is wrote for PIC16F877, to 24C128. How can i do this event_?

Could you help me about this, please_?

Thanks...
_________________
MurtiS
ckielstra



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

View user's profile Send private message

PostPosted: Fri Nov 09, 2007 4:30 pm     Reply with quote

Sorry, but with a PIC16 you can not run program code from an external memory. As far as I see you have the following options:
    1) Optimize your code so it uses less space.
    2) Choose another processor with more memory (if I remember correctly there is a pin compatible PIC18)
    3) Rewrite your program as a kind of interpreter, then you can run code from the external memory. This is similar to how the BASIC Stamp interpreter product works.
ckielstra



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

View user's profile Send private message

PostPosted: Sat Nov 10, 2007 9:00 am     Reply with quote

I just thought of another option.

You can not store executable code in the external eeprom but often when a program gets very large this is because you have a lot of constant data (strings, LCD-graphics, etc.). This constant data can be stored on an external memory if you want to.
ckielstra



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

View user's profile Send private message

PostPosted: Sat Nov 10, 2007 9:22 am     Reply with quote

Quote:
Now, i am using PIC18F4620... But, there is no place in PIC18F4620 Memory... So, if i can use external memory for my program, i will decide to use PIC16F877 with 24c256...

PIC18F4620 memory is 32Kb
24C256 memory is 128Kb...
Don't confuse bits, bytes and words.

The PIC18F4620 has 64kbyte == 32kbyte program words (1 instruction takes 16 bits on PIC18)
The PIC16F877 has 14kbyte = 8k program instructions (1 instruction = 14 bits on PIC16)
A 24c256 eeprom has 256kbits = 32kbyte


Conclusion:
A PIC16F877 with 24c256 = 8k instructions + 32k data
A PIC18F4620 with same 8k instructions takes 16kbytes. Leaves 64k - 16k = 48kbytes for data.
If it doesn't fit in the PIC4620 now, then it is not going to fit in the PIC16F877 + 24c256 either !

Quote:
i should write the code, that is wrote for PIC18F4620, to EEPROM... But, i do not know How i can.
Have a look at the driver directory supplied with the CCS compiler, many EEPROM driver examples can be found there.
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