about programming Atmel 89c51

Mar 06, 2006 4 Replies

hi everyone !!!!!!!!!!!!!! I am making a project using Atmel 89c52 and i am stuck up at a point... well i need to save a value permanently in its memory (so obviously i cant utilize the RAM for the purpose). So i need to punch in the value in ROM. Well is it possible that using any compiler statements of KEIL the value is placed in the ROM and later on read from there???? please tell me a way to permanently store a value in this microcontroller.



thanks



According to the data sheet I'm looking at

formatting link
(BTW, is that 89C51 or 89C52?), it's doable, but a real pain in the ass.

Why not google "serial eeprom"?

Good Luck! Rich

Presumably something on the order of

#include

#define THINGS

int ValueInROM = 0x1234;

main() { int Local;

Local = ValueInROM; }

should work, if I correctly interpret "compiler" and "KEIL" to imply that you're working in C. Otherwise, look for the MOVC instruction.

Rich Webb Norfolk, VA

If you know the value at compile time, just include it as a constant in your program.

Otherwise, I think you will need to use an external serial EEPROM. I use a 93C46 (I think - something like that) to store calibration values on some of my 89C52 projects.

I don't think there is any way for a program to write to the on-chip program EEPROM on the 89C52. Some other processors do have some program-accessible EEPROM

Peter Bennett, VE7CEI peterbb4 (at) interchange.ubc.ca new newsgroup users info : http://vancouver-webpages.com/nnq GPS and NMEA info: http://vancouver-webpages.com/peter Vancouver Power Squadron: http://vancouver.powersquadron.ca

This is one of my pet peeves, that there isn't a standard way of doing this. I use Raisonance, not Keil, and not having done anything with 8051 for 6 months I've forgotten whgat they use. So you'll have to read the manual. It's usually something like

code int xxx = yyy;

or some misuse const:

const int xxx = yyy;

Though I've seen still others where you have to use constructs like #pragma segment, that force subsequent declarations to the desired area, then remember to change back again afterwards.

C has only been around since the 70s, so it's a bit hasty to expect them to have noticed the problem yet.

Paul Burke

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required