小弟我正在做交通灯管理的毕业设计。需要用到ISIS
仿真。现在需要用keil生成HEX文件。代码如下:
ORG 0000H
LJMP MAIN
ORG 0003H
LJMP INT0
ORG 000BH
LJMP T0
ORG 0013H
LJMP INT1
ORG 001BH
LJMP T1
ORG 0100H
MAIN: MOV SP, #30H
MOV 40H, #5 ; A道红灯时间
MOV 41H, #5 ; A道绿灯时间
MOV 42H, #6 ; B道红灯时间
MOV 43H, #4 ; B道绿灯时间
MOV TMOD, #11H ;定时器初始化
MOV TH0, #3CH
MOV TL0, #0AFH
MOV TH1, #3CH
MOV TL1, #0AFH
MOV 60H, #20
MOV 61H, #60
CLR 4EH
CLR 4FH
SETB EA
SETB EX0
SETB EX1
SETB TR1
SETB ET0
SETB ET1
SETB PT1
SETB TR0
DISPLAY1:MOV P1, #11H ;显示A道红灯与B道绿灯时间
MOV R3, 40H
MOV R4, 43H
LOOP1: MOV A, R3
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FEH
MOV P0,A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0FDH
MOV P0,A
LCALL DELAY
MOV A, R4
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FBH
MOV P0,A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0F7H
MOV P0,A
LCALL DELAY
JNB 4FH,LOOP1
CLR 4FH
DEC R3
DEC R4
CJNE R4,#0FFH,LOOP1
MOV P1, #21H ; B道绿灯灭黄灯亮
LOOP2: MOV A, R3
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FEH
MOV P0,A
LCALL DELAY
MOV P2, #0FBH
MOV P0, A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0FDH
MOV P0,A
LCALL DELAY
MOV P2, #0F7H
MOV P0, A
LCALL DELAY
JNB 4FH,LOOP2
CLR 4FH
DEC R3
CJNE R3,#0FFH,LOOP2
MOV P1, #0AH ;A道红灯时间到,A道绿灯亮,B道红灯亮
DISPLAY2:MOV R3, 41H ; 显示A道绿灯 B道红灯时间
MOV R4, 42H
LOOP3: MOV A, R3
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FEH
MOV P0,A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0FDH
MOV P0,A
LCALL DELAY
MOV A, R4
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FBH
MOV P0,A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0F7H
MOV P0,A
LCALL DELAY
JNB 4FH,LOOP3
CLR 4FH
DEC R3
DEC R4
CJNE R3,#0FFH,LOOP3
MOV P1, #0CH
LOOP4: MOV A, R4 ;显示B道红灯, A道黄灯时间
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FEH
MOV P0,A
LCALL DELAY
MOV P2, #0FBH
MOV P0, A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0FDH
MOV P0,A
LCALL DELAY
MOV P2, #0F7H
MOV P0, A
LCALL DELAY
JNB 4FH,LOOP4
CLR 4FH
DEC R4
CJNE R4,#0FFH,LOOP4
LJMP DISPLAY1
;;;;;;;;;;;;定时器中断;;;;;;;;;;;;
T0: PUSH ACC
PUSH B
PUSH PSW
MOV TH0,#3CH
MOV TL0,#0AFH
DJNZ 60H,OVER
MOV 60H,#20
SETB 4FH
OVER: POP PSW
POP B
POP ACC
REti
T1: PUSH ACC
PUSH B
PUSH PSW
MOV TH1,#3CH
MOV TL1,#0AFH
DJNZ 61H,REN1
MOV 61H,#60
SETB 4EH
REN1: POP PSW
POP B
POP ACC
RETI
;;;;;;;;;;;INTO中断;;;;;;;;;;
INT0: PUSH ACC
PUSH B
PUSH PSW
MOV A,P1
PUSH ACC
MOV P1,#09H
CLR EX0
CLR TR0
LCALL DELAY ;按键消抖
JB P3.2, KEY
LJMP DISPLAY3
KEY: LJMP REN2
;;;;;;;;;;;INT1中断;;;;;;;;;;
INT1: PUSH ACC
PUSH B
PUSH PSW
MOV A,P1
PUSH ACC
JNB P3.5,K1
JNB P3.6,K2
K1: MOV P1,#11H
LJMP KG
K2: MOV P1,#0AH
LJMP KG
KG: CLR EX1
CLR TR1
LCALL DELAY ;按键消抖
JB P3.3, KK
LJMP DISPLAY3
KK: LJMP REN3
DISPLAY3:MOV R5, 40H
MOV R6, 43H
MOV A, R5
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FEH
MOV P0,A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0FDH
MOV P0,A
LCALL DELAY
MOV A, R6
MOV B, #0AH
DIV AB
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P2,#0FBH
MOV P0,A
LCALL DELAY
MOV A, B
MOVC A,@A+DPTR
MOV P2,#0F7H
MOV P0,A
LCALL DELAY
MOV A,P2
ANL A,#70H
CJNE A,#70H,DES3
LJMP DISPLAY3
DES3:LCALL DELAY
CJNE A,#70H,DES4
DES4:JNB ACC.4,DES7
JNB ACC.5,ADD1
JNB ACC.6,DEC1
DES7:JNB P2.4,DES7
LJMP DISPLAY3
ADD1:JNB P2.5,ADD1
INC 40H
INC 43H
LJMP DISPLAY3
DEC1:JNB P2.6,DEC1
DEC 40H
DEC 43H
LJMP DISPLAY3
REN2: CLR 4EH
CLR TR1
MOV TH1,#3CH
MOV TL1,#0AFH
SETB EX0
SETB TR0
POP ACC
MOV P1,A
POP PSW
POP B
POP ACC
RETI
REN3: CLR 4EH
CLR TR1
MOV TH1,#3CH
MOV TL1,#0AFH
SETB EX1
SETB TR1
POP ACC
MOV P1,A
POP PSW
POP B
POP ACC
RETI
DELAY: MOV R1,#40
D1: MOV R7,#50
DJNZ R7,$
DJNZ R1,D1
RET
TAB: DB 3FH 06H 5BH 4FH 66H 6DH 7DH 07H 7FH 6FH
END
但是编译的时候提示我
Text1.a(4): error A46: CODE-ADDRESS EXPECTED
Text1.a(6): error A46: CODE-ADDRESS EXPECTED
Text1.a(8): error A46: CODE-ADDRESS EXPECTED
Text1.a(10): error A46: CODE-ADDRESS EXPECTED
Text1.a(157): error A8: ATTEMPT TO DEFINE AN ALREADY DEFINED LABEL
Text1.a(169): error A8: ATTEMPT TO DEFINE AN ALREADY DEFINED LABEL
Text1.a(184): error A8: ATTEMPT TO DEFINE AN ALREADY DEFINED LABEL
Text1.a(199): error A8: ATTEMPT TO DEFINE AN ALREADY DEFINED LABEL
Text1.a(294): error A34: ',' EXPECTED
Text1.a(294): error A34: ',' EXPECTED
Text1.a(294): error A34: ',' EXPECTED
Text1.a(294): error A34: ',' EXPECTED
Text1.a(294): error A34: ',' EXPECTED
小弟汇编知识超菜。。请问谁能告诉我怎么办吗?
0