LNUM EQU 30H
ORG 0000H
JMP START
ORG 0100H
START:MOV SP,#5FH
MOV R7,#0FEH
MOV R2,#0
MOV 50H,#0
MOV 51H,#0
MOV 52H,#0
MOV LNUM,#4
CLR F0
ST1:CALL MAKEY
JNB F0,ST1
MOV P2,R7
ANL A,#0FH
MOV DPTR,#LED_A
MOVC A,@A+DPTR
MOV P0,A
CJNE R2,#1H,Y1
JMP LOOP1
CJNE R2,#2H,Y1
JMP LOOP2
CJNE R2,#3H,Y1
JMP LOOP3
CJNE R2,#4H,Y1
JMP LOOP4
loop1:CJNE A,#0,NEXT1
MOV 50H,A
NEXT1:CJNE A,#1,NEXT2
MOV 50H,A
NEXT2:CJNE A,#2,NEXT3
MOV 50H,A
NEXT3:CJNE A,#3,NEXT4
MOV 50H,A
NEXT4:CJNE A,#4,NEXT5
MOV 50H,A
NEXT5:CJNE A,#5,NEXT6
MOV 50H,A
NEXT6:CJNE A,#6,NEXT7
MOV 50H,A
NEXT7:CJNE A,#7,NEXT8
MOV 50H,A
NEXT8:CJNE A,#8,NEXT9
MOV 50H,A
NEXT9:CJNE A,#9,NEXT10
MOV 50H,A
NEXT10:CJNE A,#0AH,NEXT11
JMP Y1
NEXT11:CJNE A,#0BH,NEXT12
JMP Y1
NEXT12:CJNE A,#0CH,NEXT13
JMP Y1
NEXT13:CJNE A,#0DH,NEXT14
JMP Y1
NEXT14:CJNE A,#0EH,NEXT15
JMP Y1
NEXT15:JMP Y1
LOOP2:CJNE A,#0,NEXT110
JMP Y1
NEXT110:CJNE A,#1,NEXT22
JMP Y1
NEXT22:CJNE A,#2,NEXT32
JMP Y1
NEXT32:CJNE A,#3,NEXT44
JMP Y1
NEXT44:CJNE A,#4,NEXT55
JMP Y1
NEXT55:CJNE A,#5,NEXT66
JMP Y1
NEXT66:CJNE A,#6,NEXT77
JMP Y1
NEXT77:CJNE A,#7,NEXT88
JMP Y1
NEXT88:CJNE A,#8,NEXT99
JMP Y1
NEXT99:CJNE A,#9,NEXT100
JMP Y1
NEXT100:CJNE A,#0AH,NEXT111
JMP Y1
NEXT111:CJNE A,#0BH,NEXT122
MOV 52H,#1
NEXT122:CJNE A,#0CH,NEXT133
JMP Y1
NEXT133:CJNE A,#0DH,NEXT144
JMP Y1
NEXT144:CJNE A,#0EH,NEXT155
JMP Y1
NEXT155:JMP Y1
loop3:CJNE A,#0,NEXT1111
MOV 51,A
NEXT1111:CJNE A,#1,NEXT2222
MOV 51H,A
NEXT2222:CJNE A,#2,NEXT3333
MOV 51H,A
NEXT3333:CJNE A,#3,NEXT4444
MOV 51H,A
NEXT4444:CJNE A,#4,NEXT5555
MOV 51H,A
NEXT5555:CJNE A,#5,NEXT6666
MOV 51H,A
NEXT6666:CJNE A,#6,NEXT7777
MOV 51H,A
NEXT7777:CJNE A,#7,NEXT8888
MOV 51H,A
NEXT8888:CJNE A,#8,NEXT9999
MOV 51H,A
NEXT9999:CJNE A,#9,NEXT10000
MOV 51H,A
NEXT10000:CJNE A,#0AH,NEXT11111
JMP Y1
NEXT11111:CJNE A,#0BH,NEXT12222
JMP Y1
NEXT12222:CJNE A,#0CH,NEXT13333
JMP Y1
NEXT13333:CJNE A,#0DH,NEXT14444
JMP Y1
NEXT14444:CJNE A,#0EH,NEXT15555
JMP Y1
NEXT15555:JMP Y1
loop4:CJNE A,#0,NEXT121
JMP Y1
NEXT121:CJNE A,#1,NEXT23
JMP Y1
NEXT23:CJNE A,#2,NEXT34
JMP Y1
NEXT34:CJNE A,#3,NEXT43
JMP Y1
NEXT43:CJNE A,#4,NEXT53
JMP Y1
NEXT53:CJNE A,#5,NEXT63
JMP Y1
NEXT63:CJNE A,#6,NEXT73
JMP Y1
NEXT73:CJNE A,#7,NEXT83
JMP Y1
NEXT83:CJNE A,#8,NEXT93
JMP Y1
NEXT93:CJNE A,#9,NEXT103
JMP Y1
NEXT103:CJNE A,#0AH,NEXT113
JMP Y1
NEXT113:CJNE A,#0BH,NEXT123
JMP Y1
NEXT123:CJNE A,#0CH,NEXT134
JMP Y1
NEXT134:CJNE A,#0DH,NEXT143
JMP Y1
NEXT143:CJNE A,#0EH,NEXT153
JMP Y1
NEXT153:JMP Y2
Y1:CLR F0
MOV P0,#0FFH
JMP START
Y2:MOV R2,50H
DJNZ R2,Y1
JMP Z1
Z1:MOV A,#50H
ADD A,#51H
JMP START
MAKEY:CALL KEYHN
JNZ HAVE
JMP NRET
HAVE:CALL D10
CALL KEYHN
JNZ TRUE
JMP NRET
TRUE:MOV R1,#0EFH
MOV R4,#0
SCAN:MOV A,R1
MOV P3,A
MOV A,P3
JB ACC.0,L1
MOV A,#0
JMP KEYNUM
L1:JB ACC.1,L2
MOV A,#4
JMP KEYNUM
L2:JB ACC.2,L3
MOV A,#8
JMP KEYNUM
L3:JB ACC.3,NEXT
MOV A,#0CH
KEYNUM:ADD A,R4
PUSH ACC
UPKEY:CALL KEYHN
JNZ UPKEY
POP ACC
SETB F0
JMP HRET
NRET:CLR F0
HRET:RET
NEXT:INC R4
MOV A,R1
DJNZ LNUM,NDONE
JMP NRET
NDONE:RL A
MOV R1,A
JMP SCAN
KEYHN:MOV P3,#0FH
MOV A,P3
CPL A
ANL A,#0FH
RET
D10:MOV R5,#10
D1:MOV R6,#249
DL:NOP
NOP
DJNZ R6,DL
DJNZ R5,D1
RET
LED_A: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H
DB 80H,90H,88H,83H,0C6H,0A1H,86H,8EH
TAB1: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H
DB 80H,90H,88H,83H,0C6H,0A1H,86H,8EH
END
这是我使用汇编语言设计的一个简易的计算器仅仅只可以实现一位加法运算,但是程序无法实现总是提示报错。请求各位大神解答!!!谢谢!!!
出错提示的啥?没提示你怎么知道错啊
一周热门 更多>