em viết code sau không biết bị sai đoạn nào mà sữa mãi không được. Anh chị nào biết sữa giúp em với. Cảm ơn anh chị nhiều.
ORG 0000H
MAN: MOV DPTR,#0500H
MAINA: MOV R4,#255
MAIN: MOV R2,#11111110B
MOV R3,#00
SETB C
MAINB: MOV A,R3
MOVC A,@A+DPTR
MOV P0,A
MOV P2,R2
LCALL DELAY
MOV P2,#0FFH
INC R3
MOV A,R2
RLC A
MOV R2,A
JC MAINB
DJNZ R4,MAIN
INC DPTR
MOV A,DPL
CJNE A,#10,MAINA
MANE: MOV DPTR,#0550H
MAINC: MOV R2,#01111111B
MOV R3,#0
SETB C
MAIND: MOV A,R3
MOVC A,@A+DPTR
MOV P0,A
MOV P2,R2
LCALL DELAY
MOV P2,#0FFH
INC R3
MOV A,R2
RRC A
MOV R2,A
JC MAIND
DJNZ R4,MAINC
INC DPTR
MOV A,DPH
CJNE A,#10,MAINC
LJMP MAN
DELAY: MOV R6,#01H
DE1: MOV R7,#050H
DE2: DJNZ R7,DE2
DJNZ R6,DE1
RET
ORG 500H
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0BFH,089H,088H,0BFH,0C8H,0C0H,0F9H,0BFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
ORG 550H
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0BFH,0CFH,0C0H,0C8H,0BFH,088H,089H,0BFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
END
ORG 0000H
MAN: MOV DPTR,#0500H
MAINA: MOV R4,#255
MAIN: MOV R2,#11111110B
MOV R3,#00
SETB C
MAINB: MOV A,R3
MOVC A,@A+DPTR
MOV P0,A
MOV P2,R2
LCALL DELAY
MOV P2,#0FFH
INC R3
MOV A,R2
RLC A
MOV R2,A
JC MAINB
DJNZ R4,MAIN
INC DPTR
MOV A,DPL
CJNE A,#10,MAINA
MANE: MOV DPTR,#0550H
MAINC: MOV R2,#01111111B
MOV R3,#0
SETB C
MAIND: MOV A,R3
MOVC A,@A+DPTR
MOV P0,A
MOV P2,R2
LCALL DELAY
MOV P2,#0FFH
INC R3
MOV A,R2
RRC A
MOV R2,A
JC MAIND
DJNZ R4,MAINC
INC DPTR
MOV A,DPH
CJNE A,#10,MAINC
LJMP MAN
DELAY: MOV R6,#01H
DE1: MOV R7,#050H
DE2: DJNZ R7,DE2
DJNZ R6,DE1
RET
ORG 500H
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0BFH,089H,088H,0BFH,0C8H,0C0H,0F9H,0BFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
ORG 550H
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB 0BFH,0CFH,0C0H,0C8H,0BFH,088H,089H,0BFH
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
END
Comment