Hi. I’m currently doing an project with AT89S8352 microcontroller with Assembly language. I have learnt it and done some very simple code, up to this point however. I have tried to read and understand the internal EEPROM in the micro-controller, however I am not able to write a successful code to compile and see it working on a virtual simulation program (Proteus . I really would like your help to help me understand how to make a code to read and write into the internal EEPROM of the AT89S8352. This is what I have coded so far.
EECON DATA 96H ; watchdog and memory control register
EEMEN EQU 00001000B ; EEPROM access enable bit
EEMWE EQU 00010000B ; EEPROM write enable bit
EELD EQU 00100000B ; EEPROM page load enable bit
WRTINH EQU 00000001B ; EEPROM WRTINH bit
RDY EQU 00000010B ; EEPROM RDY/BSY bit
Read:
orl EECON, #EEMEN ; enable EEPROM accesses
mov dptr, #ADDRESS ; address to read
movx a, @dptr ; read EEPROM
xrl EECON, #EEMEN ; disable EEPROM accesses
Write:
orl EECON, #EEMEN ; enable EEPROM accesses
orl EECON, #EEMWE ; enable EEPROM writes
mov a, EECON ; get EEPROM status
anl a, #WRTINH ; check WRTINH
jz ERROR ; jump if inhibited
mov dptr, #ADDRESS ; address to write
mov a, #DATA ; data to write
movx @dptr, a ; write EEPROM
call DELAY_10_MS ; wait 10 ms
movx a, @dptr ; read EEPROM
cjne a, #DATA, ERROR; jump if data compare fails
xrl EECON, #EEMWE ; disable EEPROM writes
xrl EECON, #EEMEN ; disable EEPROM accesses
My question is, what is the ADDRESS in the Read code? Is the address meant for the micro-controller or EEPROM? If it’s meant for the EEPROM, what other addresses are there?
Is the ADDRESS in Read and Write the same address? If, they are different addresses, what are they?
What is the DATA ? What kind of data can be written? Would like an example of all possible data please.