![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hi,
I am considering using an AT89C51ED2 in a project. What I would like to do is store the program and important variables in non-volatile memory. Ideally, I would load the program into a segment of EEPROM and, while it's running, save variables to another segment of EEPROM. I understand that I only have 2KB to work with. Efficiency is not an issue. Is it possible to do this on the ED2? The alternative is to use the on-board EEPROM for one thing, and some off-board EEPROM for another (I do not plan to use the Flash). Thanks in advance. |
|
|
|
|
|
|
(permalink) |
|
AT89C51ED2 has 64kB of code memory and 2kB of non-volatile data memory. So there is no question of running your program in one segement and storing variables in another segment of same memory. Your program will reside in 64kb FLASH memory while you'll be saving your variables in 2kb data EEPROM. Ofcourse it is possible to program FLASH code memory using assembley code / bootloader function calls, but it would be more sensible to put your data in separate data memory that is available.
__________________
"There is no way to peace, peace is the way!" |
|
|
|
|
|
|
(permalink) |
|
If I use the Flash, I will have to make hardware modifications (because of the external EEPROM). So my question pertains strictly to the EEPROM and not the Flash. What do you think?
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
It seems a rather strange thing to be considering, why can't you use the proper FLASH program memory? - what has the external EEPROM got to do with it?. |
||
|
|
|
|
|
(permalink) |
|
I think you haven't read the datasheet carefully or I am not getting your question.
The AT89C51ED2 has everything you want inside a single chip. You don't need to interface anything outside. i.e internally it has 64kB FLASH ROM - Exclusively for your program and is in-aplication programmable. 2kB EEPROM - This is exclusively for non-volatile data storage like your program variables. 2kB SRAM - This is where you declare all your "xdata" variables or in other words "far memory" which is used by your program at run time for temperory data storage. You put your program in any sector of 64kB flash, use that 2kB EEPROM for non-volatile variable storage. So where is the confusion? :?: Mind that the 2kB EEPROM is not meant for code execution.
__________________
"There is no way to peace, peace is the way!" |
|
|
|
|
|
|
(permalink) |
|
Yes - I will be underutilizing the chip. It would be nice to use the internal Flash program memory but it would require a modification to the PCB on which the mcu will live - memory map issues. I am switching from another microcontroller that did not have internal Flash, so I was using external EEPROM for the program space (and nothing for non-volatile memory). It would be more cost-effective to continue using the same external EEPROM.
I guess there's no way to do what I want with the EEPROM (dual-wield it, so to speak). Would be nice if I could just justify using the internal Flash and deprecate the external EEPROM altogether. Thanks for your advice. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
By EEPROM I assumed, and I think everyone else did, that you were refering to a small 8 pin I2C EEPROM?. I'm now presuming what you are refering to is an EPROM - even if it is a modern EEPROM/FLASH version, something which you can run a program from using a micro with external data and address lines. |
||
|
|
|
|
|
(permalink) |
|
Quite right, it's a PEROM. Sorry for the confusion!
|
|
|
|
|
|
|
(permalink) |
|
Ok, now I understood your problem.
You can use the same external EEPROM for program execution as well as dynamic data storage.
__________________
"There is no way to peace, peace is the way!" |
|
|
|
|
|
|
(permalink) |
|
Is there a fuse bit I can set to specify that the external PEROM should be used as program memory instead of the internal Flash? The manual mentions the Boot Loader Jump Bit which forces the application execution. I'm not certain this is the bit I should set, nor how to go about setting it.
|
|
|
|
|
|
|
(permalink) |
|
Answering my own question: Yes, the BLJB bit in the hardware security byte, with a programmer, in the study.
|
|
|
|
|