Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How can i use EEPROM in AT89S8253 micro-controller.

Status
Not open for further replies.

Varkha Agrawal

Newbie level 4
Newbie level 4
Joined
May 1, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Noida
Activity points
1,309
I want to change the preset variable in run time by use of eeprom, please help with coding.
 

The following Atmel Appnote provides an example of an EEPROM write routine in Assembly:

Atmel AT89S8253 Primer

You should be able to port the above Assembly examples to C.


Example C Routines:
Code:
void WriteEEPROM (unsigned char xdata *addr, unsigned short Data)
        { // WriteEEPROM

              EECON |= EEMEN;
              EECON |= EEMWE;

              EECON |= EELD;
              *addr = Data >> 8;

              EECON &= ~EELD;
              *(addr+1) = (unsigned char)Data;
              while (!(EECON & EERDY));

              EECON &= ~EEMWE;
              EECON &= ~EEMEN;

        } // WriteEEPROM



 short ReadEEPROM (unsigned char xdata *addr)
        { // ReadEEPROM
            short Result;

             EECON |= EEMEN;
             Result = (*addr << 8) + (*(addr+1));
             EECON &= ~EEMEN;
          
             return (Result);
        } // ReadEEPROM


BigDog
 

Actually problem is that, I want to change my preset value which is store in variable 'a' and display in lcd, suppose i set the value of a=65, but after increment it is saved in EEPROM. when power is off now it should display new value rather than 65. so how can i program for this....................and how can i store the change of value from preset value in same variable.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top