read data, registers, Read data – Rainbow Electronics T89C51RD2 User Manual
Page 48: Registers
48
Rev. F - 15 February, 2001
T89C51RD2
Example : .....
; DPTR = EEPROM data pointer, A = Data to write
Wait : MOV A,EECON
ANL A,#01h
JNZ Wait
MOV EETIM,#3Ch ; 12MHz*5 = 3Ch
MOV EECON,#02h ; EEE=1 EEPROM mapped
MOVX @DPTR,A ; Write data to EEPROM
MOV EECON,#50h or 52h ; Write Sequence
MOV EECON,#A0h or A2h
....
7.4. Read Data
The following procedure is used to read the data store in the EEPROM memory:
•
Map the program space (Set bit EEE of EECON register)
•
Load DPTR with the address to read
•
Execute a MOVX A, @DPTR
Example :
...
; DPTR = EEPROM data pointer
MOV EECON,#02h ; EEE=1 EEPROM mapped
MOVX A,@DPTR ; Read data from EEPROM
... ; A = Data
7.5. Registers
Table 25. EECON Register
EECON (S:0D2h)
EEPROM Control Register
Reset Value= XXXX XX00b
7
6
5
4
3
2
1
0
EEPL3
EEPL2
EEPL1
EEPL0
-
-
EEE
EEBUSY
Bit Number
Bit Mnemonic
Description
7-4
EEPL3-0
Programming Launch command bits
Write 5Xh followed by AXh to EECON to launch the programming.
3
-
Not implemented, reserved for future use.
a
a.
User software should not write 1s to reserved bits. These bits may be used in future 8051 family products to invoke new features. In
that case, the reset or inactive value of the new bit will be 0, and its active value will be 1. The value read from a reserved bit is
indeterminate.
2
-
Not implemented, reserved for future use.
b
b.
User software should not write 1s to reserved bits. These bits may be used in future 8051 family products to invoke new features. In
that case, the reset or inactive value of the new bit will be 0, and its active value will be 1. The value read from a reserved bit is
indeterminate.
1
EEE
Enable EEPROM Space bit
Set to map the EEPROM space during MOVX instructions (Write in the column latches)
Clear to map the data space during MOVX.
0
EEBUSY
Programming Busy flag
Set by hardware when programming is in progress.
Cleared by hardware when programming is done.
Can not be set or cleared by software.