INDF EQU 0
TMR0 EQU 1
PCL EQU 2
STATUS EQU 03H
FSR EQU 04H
PA EQU 05H
PB EQU 06H
PC EQU 07H
PD EQU 08H
KPIN EQU 08H
INTCON EQU 0BH
OPTIONR EQU 81H
TA EQU 85H
TB EQU 86H
TC EQU 87H
TD EQU 88H
KTMP EQU 20H
VAL EQU 21H
KID EQU 22H
DAT1 EQU 23H
R0 EQU 30H
R1 EQU 31H
R2 EQU 32H
R3 EQU 33H
TMB0 EQU 125
ORG 00H
NOP
GOTO MAIN
ORG 08H
MAIN
CALL MINIT
MLP:CALL DEL
BTFSS 2FH,0
GOTO MLP
CALL KEYS
CALL DISP
BCF 2FH,0
GOTO MLP
DEL:
MOVLW 250
MOVWF R3
DL1:DECFSZ R3,1
; NOP
GOTO DL1
BSF 2FH,0
RETLW 0
;DEL:BCF INTCON,2
; MOVF TMB0
;; MOVWF TMR0
;DELP:BTFSS INTCON,2
; GOTO DELP
; BSF 2FH,0
; RETURN
DISP:
MOVF VAL,0
CALL TAB
MOVWF PB
COMF PB,1
BCF PC,0
RETLW 0
KEYS:
MOVF KID,0
ADDWF PCL,1
KTAB:GOTO KEYEN
GOTO KEYDEL
GOTO KEYSCAN
GOTO KEYUP
GOTO KEYPROC
CLRF KID
RETLW 0
KEYEN:MOVLW 0FH
MOVWF KPIN
CALL DEL
NOP
MOVF KPIN,0
XORLW 0FH
BZ KEEXT
MOVLW 30
MOVWF KTMP
INCF KID,1
KEEXT:
RETLW 0
KEYDEL:
DECFSZ KTMP,1
RETLW 0
INCF KID,1
RETLW 0
KEYSCAN:
MOVLW 0FH
MOVWF KPIN
; CALL DEL
NOP
NOP
MOVF KPIN,0
XORLW 0FH
BZ KSEXT
CLRF VAL
MOVLW 0EFH
MOVWF R0
KS1:MOVF R0,0
MOVWF KPIN
; CALL DEL
NOP
; CALL DEL
MOVF KPIN,0
ANDLW 0FH
XORLW 0FH
BZ KS3
MOVWF KTMP
MOVLW 4
MOVWF R1
KS2:RRF KTMP,1
BC KVAL
; INCF VAL,1
DECFSZ R1,1
GOTO KS2
KS3:
BTFSS R0,7
GOTO KSEXT
INCF VAL,1
SETC
RLF R0,1
GOTO KS1
KVAL:
CLRC
DECF R1
RLF R1,1
RLF R1,0
ADDWF VAL,1
INCF KID,1
RETLW 0
KSEXT:CLRF KID
CLRF VAL
RETLW 0
KEYUP:
MOVLW 0FH
MOVWF KPIN
; CALL DEL
NOP
MOVF KPIN,0
XORLW 0FH
BNZ KUEXT
INCF KID
KUEXT:
RETLW 0
KEYPROC:
CLRF KID
RETLW 0
MINIT:
BSF STATUS,5
MOVLW 3
MOVWF OPTIONR
MOVLW 0FH
MOVWF TD
CLRW
MOVWF TB
MOVWF TC
BCF STATUS,5
MOVLW 0FH
MOVWF PD
MOVLW 0FFH
MOVWF PC
MOVWF PB
MOVLW 90H
MOVWF INTCON
BCF 2FH,0
CLRW
MOVWF INTCON
MOVLW 6
MOVWF R0
MOVLW 20H
MOVWF FSR
MI: CLRF INDF
INCF FSR
DECFSZ R0
GOTO MI
RETLW 0
TAB:ANDLW 0FH
ADDWF PCL
TAB1:RETLW 0XC0
RETLW 0XF9
RETLW 0XA4
RETLW 0XB0
RETLW 0X99
RETLW 0X92
RETLW 0X82
RETLW 0XF8
RETLW 0X80
RETLW 0X90
RETLW 0X88
RETLW 0X83
RETLW 0XC6
RETLW 0XA1
RETLW 0X86
RETLW 0X8E
RETLW 0X0
END
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>