用keil弄一个汇编语言的HEX文件,但是出错了,大神快来
时间:10-02
整理:3721RD
点击:
LED_BIT_1 EQU 30H
LED_BIT_2 EQU 31H
LED_BIT_3 EQU 32H
LED_BIT_4 EQU 33H
LED_BIT_5 EQU 34H
LED_BIT_6 EQU 35H
LED_BIT_7 EQU 36H
LED_BIT_8 EQU 37H
;以下6个字节存放初始密码
WORD_1 EQU 38H
WORD_2 EQU 39H
WORD_3 EQU 3AH
WORD_4 EQU 3BH
WORD_5 EQU 3CH
WORD_6 EQU 3DH
;以下6个字节存放用户输入的6位密码
KEY_1 EQU 3EH
KEY_2 EQU 3FH
KEY_3 EQU 40H
KEY_4 EQU 41H
KEY_5 EQU 42H
KEY_6 EQU 43H
;******************************************************
CNT_A EQU 44H
CNT_B EQU 45H
KEY_CNT EQU 46H ;已输出的密码位数
LINE EQU 47H ;按键行号
ROW EQU 48H ;按键列号
VAL EQU 49H ;键值
;******************************************************
;以下为初始化程序,包括数据存储空间初始化,设置初始密码
ORG 00H
SJMP START
ORG 0BH
LJMP INT_T0
START: MOV CNT_A,#00H ;程序初始化
MOV CNT_B,#00H
MOV KEY_CNT,#00H
MOV LINE,#00H
MOV ROW,#00H
MOV VAL,#00H
SETB P1.0
MOV LED_BIT_1,#00H ;段码存储区清0
MOV LED_BIT_2,#00H
MOV LED_BIT_3,#00H
MOV LED_BIT_4,#00H
MOV LED_BIT_5,#00H
MOV LED_BIT_6,#00H
MOV LED_BIT_7,#79H
MOV LED_BIT_8,#73H
MOV KEY_1,#00H ;输入密码存储区清0
MOV KEY_2,#00H
MOV KEY_3,#00H
MOV KEY_4,#00H
MOV KEY_5,#00H
MOV KEY_6,#00H
MOV WORD_1,#6 ;设置初始密码"123456"
MOV WORD_2,#5
MOV WORD_3,#4
MOV WORD_4,#3
MOV WORD_5,#2
MOV WORD_6,#1
MOV TMOD,#01H
MOV TH0,#(65536-700)/256
MOV TL0,#(65536-700)MOD 256
MOV IE,#82H
A0: LCALL DISP
;***********************************************************
;以下为键盘扫描程序,计算键值并存入VAL
LSCAN: MOV P3,#0F0H ;扫描行码
L1: JNB P3.0,L2
LCALL DLY_S
JNB P3.0,L2
MOV LINE,#00H
LJMP RSCAN
L2: JNB P3.1,L3
LCALL DLY_S
JNB P3.1,L3
MOV LINE,#01H
LJMP RSCAN
L3: JNB P3.2,L4
LCALL DLY_S
JNB P3.2,L4
MOV LINE,#02H
LJMP RSCAN
L4: JNB P3.3,A0
LCALL DLY_S
JNB P3.3,A0
MOV LINE,#03H
RSCAN: MOV P3,#0FH ;扫描列码
C1: JNB P3.4,C2
MOV ROW,#00H
LJMP CALCU
C2: JNB P3.5,C3
MOV ROW,#01H
LJMP CALCU
C3: JNB P3.6,C1
MOV ROW,#02H
CALCU: MOV A,LINE ;计算键值
MOV B,#03H
MUL AB
ADD A,ROW
MOV VAL,A
;**************************************************
;以下为按键处理程序,对不同的按键作出响应
CJNE A,#0AH,J1 ;是否为"CLR"键
MOV R1,KEY_CNT
CJNE R1,#00H,J2
LCALL ALARM_1
LJMP START
J2: LCALL SHIFTR
DEC KEY_CNT
W00: LCALL DISP ;等待按键抬起
MOV A,P3
CJNE A,#0FH,W01
LJMP A0
W01: MOV A,P3
CJNE A,#0F0H,W02
LJMP A0
W02: SJMP W00
J1: MOV A,VAL
CJNE A,#0BH,J3 ;判断是否为"ENTER"键
MOV R1,KEY_CNT
CJNE R1,#06H,J4
MOV A,WORD_1 ;比较密码
CJNE A,3EH,J5
MOV A,WORD_2
CJNE A,3FH,J5
MOV A,WORD_3
CJNE A,40H,J5
MOV A,WORD_4
JNE A,41H,J5
MOV A,WORD_5
CJNE A,42H,J5
MOV A,WORD_6
CJNE A,43H,J5
CLR P1.0
LCALL DLY_L
LJMP FINI
J5: LCALL ALARM_2
LJMP START
J4: LCALL ALARM_1
LJMP START
J3: INC KEY_CNT ;按下数字键
MOV A,KEY_CNT
CJNE A,#07H,K1
LCALL ALARM_1
W10: LCALL DISP ;等待按键抬起
MOV A,P3
CJNE A,#0FH,W11
LJMP START
W11: MOV A,P3
CJNE A,#0F0H,W12
LJMP START
W12: SJMP W10
LJMP START
LJMP START
K1: LCALL SHIFTL
W20: LCALL DISP ;等待按键抬起
MOV A,P3
CJNE A,#0FH,W21
LJMP A0
W21: MOV A,P3
CJNE A,#0F0H,W22
LJMP A0
W22: SJMP W20
LJMP A0
ALARM_1: SETB TR0 ;操作错误报警
JB TR0,$
RET
ALARM_2: SETB TR0 ;密码错误报警
JB TR0,$
LCALL DLY_L
RET
;**************************************************
;定时器中断服务程序,用于声音报警
INT_T0: CPL P1.7
MOV TH0,#100
MOV TL0,#253
INC CNT_A
MOV R1,CNT_A
CJNE R1,#30,RETUNE
MOV CNT_A,#00H
INC CNT_B
MOV R1,CNT_B
CJNE R1,#20,RETUNE
MOV CNT_A,#00H
MOV CNT_B,#00H
CLR TR0
RETUNE: RETI
;**************************************************
;段码,输入密码左移子程序
SHIFTL: MOV LED_BIT_6,LED_BIT_5
MOV LED_BIT_5,LED_BIT_4
MOV LED_BIT_4,LED_BIT_3
MOV LED_BIT_2,LED_BIT_1
MOV LED_BIT_1,#40H
MOV KEY_6,KEY_5
MOV KEY_5,KEY_4
MOV KEY_4,KEY_3
MOV KEY_3,KEY_2
MOV KEY_2,KEY_1
MOV KEY_1,VAL
RET
;**************************************************
;段码,输入密码右移子程序
SHIFTR: MOV LED_BIT_1,LED_BIT_2
MOV LED_BIT_2,LED_BIT_3
MOV LED_BIT_3,LED_BIT_4
MOV LED_BIT_4,LED_BIT_5
MOV LED_BIT_5,LED_BIT_6
MOV LED_BIT_6,#00H
MOV KEY_1,KEY_2
MOV KEY_2,KEY_3
MOV KEY_3,KEY_4
MOV KEY_4,KEY_5
MOV KEY_5,KEY_6
MOV KEY_6,#00H
RET
;**************************************************
;以下为数码显示子程序
DISP: CLR P2.7
MOV P0,LED_BIT_8
LCALL DLY_S
SETB P2.7
CLR P2.6
MOV P0,LED_BIT_7
LCALL DLY_S
SETB P2.6
CLR P2.5
MOV P0,LED_BIT_6
LCALL DLY_S
SETB P2.5
CLR P2.4
MOV P0,LED_BIT_5
LCALL DLY_S
SETB P2.4
CLR P2.3
MOV P0,LED_BIT_4
LCALL DLY_S
SETB P2.3
CLR P2.2
MOV P0,LED_BIT_3
LCALL DLY_S
SETB P2.2
CLR P2.1
MOV P0,LED_BIT_2
SETB P2.1
CLR P2.0
MOV P0,LED_BIT_1
LCALL DLY_S
SETB P2.0
RET
;**********************************************
DLY_S: MOV R6,#10
D1: MOV R7,#250
DJNZ R7,$
DJNZ R6,D1
RET
DLY_L: MOV R5,#100
D2: MOV R6,#100
D3: MOV R7,#248
DJNZ R7,$
DJNZ R6,D3
DJNZ R5,D2
RET
FINI: NOP
END
Build target 'Target 1'
assembling text.asm...
text.asm(132): error A9: SYNTAX ERROR
Target not created
LED_BIT_2 EQU 31H
LED_BIT_3 EQU 32H
LED_BIT_4 EQU 33H
LED_BIT_5 EQU 34H
LED_BIT_6 EQU 35H
LED_BIT_7 EQU 36H
LED_BIT_8 EQU 37H
;以下6个字节存放初始密码
WORD_1 EQU 38H
WORD_2 EQU 39H
WORD_3 EQU 3AH
WORD_4 EQU 3BH
WORD_5 EQU 3CH
WORD_6 EQU 3DH
;以下6个字节存放用户输入的6位密码
KEY_1 EQU 3EH
KEY_2 EQU 3FH
KEY_3 EQU 40H
KEY_4 EQU 41H
KEY_5 EQU 42H
KEY_6 EQU 43H
;******************************************************
CNT_A EQU 44H
CNT_B EQU 45H
KEY_CNT EQU 46H ;已输出的密码位数
LINE EQU 47H ;按键行号
ROW EQU 48H ;按键列号
VAL EQU 49H ;键值
;******************************************************
;以下为初始化程序,包括数据存储空间初始化,设置初始密码
ORG 00H
SJMP START
ORG 0BH
LJMP INT_T0
START: MOV CNT_A,#00H ;程序初始化
MOV CNT_B,#00H
MOV KEY_CNT,#00H
MOV LINE,#00H
MOV ROW,#00H
MOV VAL,#00H
SETB P1.0
MOV LED_BIT_1,#00H ;段码存储区清0
MOV LED_BIT_2,#00H
MOV LED_BIT_3,#00H
MOV LED_BIT_4,#00H
MOV LED_BIT_5,#00H
MOV LED_BIT_6,#00H
MOV LED_BIT_7,#79H
MOV LED_BIT_8,#73H
MOV KEY_1,#00H ;输入密码存储区清0
MOV KEY_2,#00H
MOV KEY_3,#00H
MOV KEY_4,#00H
MOV KEY_5,#00H
MOV KEY_6,#00H
MOV WORD_1,#6 ;设置初始密码"123456"
MOV WORD_2,#5
MOV WORD_3,#4
MOV WORD_4,#3
MOV WORD_5,#2
MOV WORD_6,#1
MOV TMOD,#01H
MOV TH0,#(65536-700)/256
MOV TL0,#(65536-700)MOD 256
MOV IE,#82H
A0: LCALL DISP
;***********************************************************
;以下为键盘扫描程序,计算键值并存入VAL
LSCAN: MOV P3,#0F0H ;扫描行码
L1: JNB P3.0,L2
LCALL DLY_S
JNB P3.0,L2
MOV LINE,#00H
LJMP RSCAN
L2: JNB P3.1,L3
LCALL DLY_S
JNB P3.1,L3
MOV LINE,#01H
LJMP RSCAN
L3: JNB P3.2,L4
LCALL DLY_S
JNB P3.2,L4
MOV LINE,#02H
LJMP RSCAN
L4: JNB P3.3,A0
LCALL DLY_S
JNB P3.3,A0
MOV LINE,#03H
RSCAN: MOV P3,#0FH ;扫描列码
C1: JNB P3.4,C2
MOV ROW,#00H
LJMP CALCU
C2: JNB P3.5,C3
MOV ROW,#01H
LJMP CALCU
C3: JNB P3.6,C1
MOV ROW,#02H
CALCU: MOV A,LINE ;计算键值
MOV B,#03H
MUL AB
ADD A,ROW
MOV VAL,A
;**************************************************
;以下为按键处理程序,对不同的按键作出响应
CJNE A,#0AH,J1 ;是否为"CLR"键
MOV R1,KEY_CNT
CJNE R1,#00H,J2
LCALL ALARM_1
LJMP START
J2: LCALL SHIFTR
DEC KEY_CNT
W00: LCALL DISP ;等待按键抬起
MOV A,P3
CJNE A,#0FH,W01
LJMP A0
W01: MOV A,P3
CJNE A,#0F0H,W02
LJMP A0
W02: SJMP W00
J1: MOV A,VAL
CJNE A,#0BH,J3 ;判断是否为"ENTER"键
MOV R1,KEY_CNT
CJNE R1,#06H,J4
MOV A,WORD_1 ;比较密码
CJNE A,3EH,J5
MOV A,WORD_2
CJNE A,3FH,J5
MOV A,WORD_3
CJNE A,40H,J5
MOV A,WORD_4
JNE A,41H,J5
MOV A,WORD_5
CJNE A,42H,J5
MOV A,WORD_6
CJNE A,43H,J5
CLR P1.0
LCALL DLY_L
LJMP FINI
J5: LCALL ALARM_2
LJMP START
J4: LCALL ALARM_1
LJMP START
J3: INC KEY_CNT ;按下数字键
MOV A,KEY_CNT
CJNE A,#07H,K1
LCALL ALARM_1
W10: LCALL DISP ;等待按键抬起
MOV A,P3
CJNE A,#0FH,W11
LJMP START
W11: MOV A,P3
CJNE A,#0F0H,W12
LJMP START
W12: SJMP W10
LJMP START
LJMP START
K1: LCALL SHIFTL
W20: LCALL DISP ;等待按键抬起
MOV A,P3
CJNE A,#0FH,W21
LJMP A0
W21: MOV A,P3
CJNE A,#0F0H,W22
LJMP A0
W22: SJMP W20
LJMP A0
ALARM_1: SETB TR0 ;操作错误报警
JB TR0,$
RET
ALARM_2: SETB TR0 ;密码错误报警
JB TR0,$
LCALL DLY_L
RET
;**************************************************
;定时器中断服务程序,用于声音报警
INT_T0: CPL P1.7
MOV TH0,#100
MOV TL0,#253
INC CNT_A
MOV R1,CNT_A
CJNE R1,#30,RETUNE
MOV CNT_A,#00H
INC CNT_B
MOV R1,CNT_B
CJNE R1,#20,RETUNE
MOV CNT_A,#00H
MOV CNT_B,#00H
CLR TR0
RETUNE: RETI
;**************************************************
;段码,输入密码左移子程序
SHIFTL: MOV LED_BIT_6,LED_BIT_5
MOV LED_BIT_5,LED_BIT_4
MOV LED_BIT_4,LED_BIT_3
MOV LED_BIT_2,LED_BIT_1
MOV LED_BIT_1,#40H
MOV KEY_6,KEY_5
MOV KEY_5,KEY_4
MOV KEY_4,KEY_3
MOV KEY_3,KEY_2
MOV KEY_2,KEY_1
MOV KEY_1,VAL
RET
;**************************************************
;段码,输入密码右移子程序
SHIFTR: MOV LED_BIT_1,LED_BIT_2
MOV LED_BIT_2,LED_BIT_3
MOV LED_BIT_3,LED_BIT_4
MOV LED_BIT_4,LED_BIT_5
MOV LED_BIT_5,LED_BIT_6
MOV LED_BIT_6,#00H
MOV KEY_1,KEY_2
MOV KEY_2,KEY_3
MOV KEY_3,KEY_4
MOV KEY_4,KEY_5
MOV KEY_5,KEY_6
MOV KEY_6,#00H
RET
;**************************************************
;以下为数码显示子程序
DISP: CLR P2.7
MOV P0,LED_BIT_8
LCALL DLY_S
SETB P2.7
CLR P2.6
MOV P0,LED_BIT_7
LCALL DLY_S
SETB P2.6
CLR P2.5
MOV P0,LED_BIT_6
LCALL DLY_S
SETB P2.5
CLR P2.4
MOV P0,LED_BIT_5
LCALL DLY_S
SETB P2.4
CLR P2.3
MOV P0,LED_BIT_4
LCALL DLY_S
SETB P2.3
CLR P2.2
MOV P0,LED_BIT_3
LCALL DLY_S
SETB P2.2
CLR P2.1
MOV P0,LED_BIT_2
SETB P2.1
CLR P2.0
MOV P0,LED_BIT_1
LCALL DLY_S
SETB P2.0
RET
;**********************************************
DLY_S: MOV R6,#10
D1: MOV R7,#250
DJNZ R7,$
DJNZ R6,D1
RET
DLY_L: MOV R5,#100
D2: MOV R6,#100
D3: MOV R7,#248
DJNZ R7,$
DJNZ R6,D3
DJNZ R5,D2
RET
FINI: NOP
END
Build target 'Target 1'
assembling text.asm...
text.asm(132): error A9: SYNTAX ERROR
Target not created
各位大神帮帮忙
到底哪里错了,真的不知道怎么改了。