请问这是什么地方有错!(高手请进)
include HT46C64.incds .section 'data'
cs .section 'code'
;---------------------------------------------
DATA .SECTION AT 60H 'DATA'
DISPLAY_DATA DB ?
DISPLAY_COUNTER DB ?
SCAN_COUNTER DB ?
SCAN_DATA DB ?
SCAN_CODE DB ?
;----------------------------------------------
CODE .SECTION AT 00H 'CODE'
ORG 00H
JMP STARTS
STARTS:
CLR PAC.4
CLR PA.4
CLR PDC
CLR PD
MOV A,0F0H
MOV PBC,A ;给PB口赋值
SET PB ;设置为高电平
; CLR PDC
; CLR PD ;B口全输出0(初始状态)
SCAN_BEGIN:
MOV A,04H ;扫描4次 并送入A里面
MOV SCAN_COUNTER,A
MOV A,0E0H ;;;; ;70H即0111
MOV SCAN_DATA,A ;产生SCAN_DATA 进行扫描
SCAN_NEXT:
; MOV A,SCAN_DATA
MOV PB,A
CALL KEY_IN
SET C ;C被移至PB7
RLC SCAN_DATA
MOV A,SCAN_DATA
AND A,0F0H ;相与,取出高4位 低四位清零
SDZ SCAN_COUNTER
JMP SCAN_NEXT
JMP SCAN_BEGIN
RET
;---------------------------------------------
ORG 0E0H
DC 0EEH,0DEH,0BEH,07EH
DC 0EDH,0DDH,0BDH,07DH
DC 0EBH,0DBH,0BBH,07BH
DC 0E7H,0D7H,0B7H,077H
KEY_IN PROC ;该子程序主要作用是检测那一个键被按下。
CLR TBLP
MOV A,10H
MOV DISPLAY_COUNTER,A ;10H送入显示寄存器
SCAN_KEY:
TABRDL DISPLAY_DATA ;查表指令,指向最后一页 0F00H
TABRDC SCAN_CODE ;当前页进行查表 即:0E00H
INC TBLP
MOV A,PB
SUB A,SCAN_CODE ;A与按键相减 ,等于零即可显示
SZ ACC
JMP NEXT_CODE
MOV A,DISPLAY_DATA
MOV PD,A
KEY_STATUS: ;检测按键是否已经被放开
MOV A,PB
AND A,0F0H
XOR A,0F0H
SZ ACC
JMP KEY_STATUS
JMP OVER
NEXT_CODE:
SDZ DISPLAY_COUNTER
JMP SCAN_KEY
OVER:
RET
KEY_IN ENDP
;-------------------------------------------------
ORG 0F00H
DC 0C0H,0F9H,0A4H,0B0H
DC 99H,92H,82H,0F8H
DC 80H,90H,88H,83H
DC 0C6H,0A1H,86H,8EH
;------------------------------------------------
END