AT89S8253
5.5
5.6
Dual Data Pointer Registers
To facilitate accessing both internal EEPROM and external data memory, two banks of 16-bit
Data Pointer Registers are provided: DP0 at SFR address locations 82H - 83H and DP1 at 84H
- 85H. Bit DPS = 0 in SFR EECON selects DP0 and DPS = 1 selects DP1. The user should
ALWAYS initialize the DPS bit to the appropriate value before accessing the respective Data
Pointer Register.
Power Off Flag
The Power Off Flag (POF), located at bit_4 (PCON.4) in the PCON SFR. POF, is set to “1” dur-
ing power up. It can be set and reset under software control and is not affected by RESET.
6. Data Memory – EEPROM and RAM
The AT89S8253 implements 2K bytes of on-chip EEPROM for data storage and 256 bytes of
RAM. The upper 128 bytes of RAM occupy a parallel space to the Special Function Registers.
That means the upper 128 bytes have the same addresses as the SFR space but are physically
separate from SFR space.
When an instruction accesses an internal location above address 7FH, the address mode used
in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR
space. Instructions that use direct addressing access the SFR space.
For example, the following direct addressing instruction accesses the SFR at location 0A0H
(which is P2).
MOV 0A0H, #data
Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the
following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at
address 0A0H, rather than P2 (whose address is 0A0H).
MOV @R0, #data
Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data
RAM are available as stack space.
The on-chip EEPROM data memory is selected by setting the EEMEN bit in the EECON register
at SFR address location 96H. The EEPROM address range is from 000H to 7FFH. MOVX
instructions are used to access the EEPROM. To access off-chip data memory with the MOVX
instructions, the EEMEN bit needs to be set to “0”.
During program execution mode (using the MOVX instruction) there is an auto-erase capability
at the byte level. This means that the user can update or modify a single EEPROM byte location
in real-time without affecting any other bytes.
The EEMWE bit in the EECON register needs to be set to “1” before any byte location in the
EEPROM can be written. User software should reset EEMWE bit to “0” if no further EEPROM
write is required. EEPROM write cycles in the serial programming mode are self-timed and typi-
cally take 4 ms. The progress of EEPROM write can be monitored by reading the RDY/BSY bit
(read-only) in SFR EECON. RDY/BSY = 0 means programming is still in progress and RDY/BSY
= 1 means an EEPROM write cycle is completed and another write cycle can be initiated. Bit
EELD in EECON controls whether the next MOVX instruction will only load the write buffer of the
EEPROM or will actually start the programming cycle. By setting EELD, only load will occur.
Before the last MOVX in a given page of 32 bytes, EELD should be cleared so that after the last
MOVX the entire page will be programmed at the same time. This way, 32 bytes will only require
4 ms of programming time instead of 128 ms required in single byte programming.
9
3286H–MICRO–9/05