đề bài là:2 led đếm lẻ - 2 led đếm chẵn ra , đếm đồng thời
CHAN EQU 30H
LE EQU 31H
BND EQU R2
ORG 0000H
JMP MAIN
ORG 00BH
MOV TH0,#HIGH(-50000)
MOV TL0,#LOW(-50000)
INC BND
CJNE BND,#20,EXIT
MAIN1:
MOV BND,#0
MOV LE,#1
MAIN2:
CALL GM_HT1
INC LE
ADD LE,#1
CJNE LE,#19,MAIN2
JMP MAIN1
EXIT: RETI
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAIN: MOV DPTR,#MA7DOAN
MOV IE,#10000010B
MOV TMOD,#00000001B
SETB TR0
MOV BND,#0
X1:
MOV CHAN,#0
X2:
CALL GM_HT2
INC CHAN
ADD CHAN,#1
CJNE CHAN,#20,X2
JMP X1
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GM_HT2:
MOV A,CHAN
MOV B,#10
DIV AB
MOVC A,@A+DPTR
MOV A,21H ;CHUC
MOV A,B
MOVC A,@A+DPTR
MOV A,22H ;DONVI
MOV 6FH,#01
DEL2: MOV 6EH,#0FFH
DEL1: CALL HIENTHI
DJNZ 6EH,DEL1
DJNZ 6FH,DEL2
RET
HIENTHI:
MOV P0,21H
CLR P2.0
CALL DELAY1MS
SETB P2.0
MOV P0,22H
CLR P2.1
CALL DELAY1MS
SETB P2.1
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GM_HT1:
MOV A,LE
MOV B,#10
DIV AB
MOVC A,@A+DPTR
MOV A,24H ;CHUC
MOV A,B
MOVC A,@A+DPTR
MOV A,25H ;DONVI
MOV 6FH,#01
DEL4: MOV 6EH,#0FFH
DEL3: CALL HIENTHI1
DJNZ 6EH,DEL3
DJNZ 6FH,DEL4
RET
HIENTHI1:
MOV P0,24H
CLR P2.5
CALL DELAY1MS
SETB P2.5
MOV P0,25H
CLR P2.6
CALL DELAY1MS
SETB P2.6
RET
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MA7DOAN: DP 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
$INCLUDE(TV_DELAY.ASM)
end
Các lỗi
0030 1 CHAN EQU 30H
2 LE EQU 31H
_________________________________^
*** ERROR #1, LINE #2 (0), SYNTAX ERROR
94 MA7DOAN: DP 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
_________________________________________^
*** ERROR #1, LINE #94 (66), SYNTAX ERROR
CHAN EQU 30H
LE EQU 31H
BND EQU R2
ORG 0000H
JMP MAIN
ORG 00BH
MOV TH0,#HIGH(-50000)
MOV TL0,#LOW(-50000)
INC BND
CJNE BND,#20,EXIT
MAIN1:
MOV BND,#0
MOV LE,#1
MAIN2:
CALL GM_HT1
INC LE
ADD LE,#1
CJNE LE,#19,MAIN2
JMP MAIN1
EXIT: RETI
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAIN: MOV DPTR,#MA7DOAN
MOV IE,#10000010B
MOV TMOD,#00000001B
SETB TR0
MOV BND,#0
X1:
MOV CHAN,#0
X2:
CALL GM_HT2
INC CHAN
ADD CHAN,#1
CJNE CHAN,#20,X2
JMP X1
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GM_HT2:
MOV A,CHAN
MOV B,#10
DIV AB
MOVC A,@A+DPTR
MOV A,21H ;CHUC
MOV A,B
MOVC A,@A+DPTR
MOV A,22H ;DONVI
MOV 6FH,#01
DEL2: MOV 6EH,#0FFH
DEL1: CALL HIENTHI
DJNZ 6EH,DEL1
DJNZ 6FH,DEL2
RET
HIENTHI:
MOV P0,21H
CLR P2.0
CALL DELAY1MS
SETB P2.0
MOV P0,22H
CLR P2.1
CALL DELAY1MS
SETB P2.1
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GM_HT1:
MOV A,LE
MOV B,#10
DIV AB
MOVC A,@A+DPTR
MOV A,24H ;CHUC
MOV A,B
MOVC A,@A+DPTR
MOV A,25H ;DONVI
MOV 6FH,#01
DEL4: MOV 6EH,#0FFH
DEL3: CALL HIENTHI1
DJNZ 6EH,DEL3
DJNZ 6FH,DEL4
RET
HIENTHI1:
MOV P0,24H
CLR P2.5
CALL DELAY1MS
SETB P2.5
MOV P0,25H
CLR P2.6
CALL DELAY1MS
SETB P2.6
RET
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MA7DOAN: DP 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
$INCLUDE(TV_DELAY.ASM)
end
Các lỗi
0030 1 CHAN EQU 30H
2 LE EQU 31H
_________________________________^
*** ERROR #1, LINE #2 (0), SYNTAX ERROR
94 MA7DOAN: DP 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
_________________________________________^
*** ERROR #1, LINE #94 (66), SYNTAX ERROR
Comment