This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

XBYTE [] Addressing Problem

HI,

How to specify a address while writing to EEPROM in 89c51ED2.

It is writing to EEPROM when I give the following code after setting the flags of EECON register.


  XBYTE[0x0050] = '1';

But if I declare a variable with following type and assign a value to it, it is not writing to EEPROM

  unsigned char xdata *addr;
  *addr = '1';

//after setting all the flags i write this code for assigning;

 *addr = '2';

But this is not writing to EEPROM.

Kindly provide the solution for this.

Parents
  • "Can I use Global variable and use after setting EEE register"

    Note that EEE is a bit - not a register.

    Your problem is accessing XDATA - see the description of the EEE bit in the datasheet.
    It makes no difference whether the variabe is global or "automatic" - the problem is with accessing XDATA.

    So, as long as you don't attempt to access anything in XDATA while EEE is set, you should be OK...

Reply
  • "Can I use Global variable and use after setting EEE register"

    Note that EEE is a bit - not a register.

    Your problem is accessing XDATA - see the description of the EEE bit in the datasheet.
    It makes no difference whether the variabe is global or "automatic" - the problem is with accessing XDATA.

    So, as long as you don't attempt to access anything in XDATA while EEE is set, you should be OK...

Children
No data