Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 18th November 2004, 06:27 PM   (permalink)
Default 89C51 ED2 - EEPROM access while program read?

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.
fire is offline   Reply With Quote
Old 19th November 2004, 03:27 AM   (permalink)
Default

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!"
kinjalgp is offline   Reply With Quote
Old 19th November 2004, 07:39 PM   (permalink)
Default

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?
fire is offline   Reply With Quote
Old 20th November 2004, 05:44 AM   (permalink)
Default

Quote:
Originally Posted by fire
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?
I'm not familiar with your processor, but is it possible to run a program from external EEPROM?. And assuming it was?, EEPROM is VERY slow.

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?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 20th November 2004, 11:30 AM   (permalink)
Default

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!"
kinjalgp is offline   Reply With Quote
Old 22nd November 2004, 04:28 PM   (permalink)
Default

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.
fire is offline   Reply With Quote
Old 22nd November 2004, 05:19 PM   (permalink)
Default

Quote:
Originally Posted by fire
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.
I think we may have all been talking at cross purposes here?.

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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 22nd November 2004, 05:45 PM   (permalink)
Default

Quite right, it's a PEROM. Sorry for the confusion!
fire is offline   Reply With Quote
Old 23rd November 2004, 01:30 PM   (permalink)
Default

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!"
kinjalgp is offline   Reply With Quote
Old 3rd December 2004, 06:30 PM   (permalink)
Default

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.
fire is offline   Reply With Quote
Old 3rd December 2004, 11:55 PM   (permalink)
Default

Answering my own question: Yes, the BLJB bit in the hardware security byte, with a programmer, in the study.
fire is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 12:53 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.