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

Assess high "128 byte" and 2k eeprom inside AT89s8252 By C

How can Assess high "128 byte" and 2k eeprom inside AT89s8252 By C language?
where can i find any example about that?
pls help.

  • For DATA space addresses 0x80 to 0xFF just declare them as SFRs.

    sfr port0 = 0x80; /* 128 byte? */
    
    if (port0 & 0x01) port0 = 0xAA;
    I don't know about the EEPROM. If it is XDATA mapped, just create a pointer to xdata and point to it. If register mapped, read the data book.

  • "If it is XDATA mapped, just create a pointer to xdata and point to it."

    Or use the _at_ keyword extension,
    Or use Linker controls to locate your variables appropriately within the EEPROM XDATA address range.

    either way, you will need to read the appropriate Manual

  • Hi Ru,

    If you want to use 0x80 to 0xFF declare your variables as type 'idata' then that should allow you to access the upper 128 bytes (it can also be used for the lower 128 bytes as well but ideally you should use 'data' for this area) eg

    int idata mydata;

    will ( i think) once data memory runs out start to use idata memory to store variables.
    I am not sure about the 2k eeprom, but if you want to program it from within your program, from the data sheet, you need to program a SFR and you need to think of it as xdata in the range 0 to 0x7FF in your program to access it.
    Hope this helps,
    Mark.