EEPROM test code problem.

Thread Starter

NexusRevZ

Joined Jul 29, 2014
1
This simple code is test the write and read of EEPROM on AT89S8253.

Firstly the LED at P1 will have all LED on, after a sec, have the P1 will have LED on.
Next, code is to write 01010101B into the EEPROM.
CJNE will check to see if it is written.
But, after comparing, the data isn't similar and the code is restarted.

If the writing process works the LED at P1.0 should be the only LED on, which will notify the success of writing into the EEPROM.

The next portion of the code will recall/read the written data in the EEPROM.
f it is able to read, P1 will have alternate LED on and off.
Please provide solutions, sources and why or what I had done wrong, to educate me. Thank you.

=============================

Rich (BB code):
org 0
jmp start
eecon EQU 96h

start:
MOV A,#11111111B
MOV P1,A
ACALL DELAY0
MOV A,#00001111B
MOV P1,A
ACALL DELAY0

WRITE:
MOV EECON,#00001000b

mov dptr,#0 ;point to the memory location needed to write to. chosen location 0
mov a,#10101010B ;move the data (0fch) to Accumulator
movx @dptr,a ;write the data to the chosen location

MOVX A, @DPTR
CJNE A, #10101010B, START

WRITEFIN:
MOV A,#00000001B
MOV P1,A
ACALL DELAY0
READ:
MOV EECON,#00001000b
mov DPTR,#0 ;point to the memory location needed to read from. Chosen location 0
movx A,@dptr ;move the data within the memory location to the Accumulator
mov R0,A ;move the data within Accumulator to the Register

WAT: MOV P1,R0
SJMP WAT

;========================================
DELAY0:
ACALL DELAY
ACALL DELAY
ACALL DELAY
ACALL DELAY
ACALL DELAY
RET
DELAY:
MOV R3, #255
HERE2:
MOV R4, #255
HERE:
DJNZ R4, HERE
DJNZ R3, HERE2
RET
end
 
Last edited by a moderator:
Top