PIC單片機(jī)的4*4鍵盤(pán)程序?qū)嵗?/h1>
!--StartFragment-->;-------4*4鍵盤(pán)程序的使用--------
PC EQU 2
STATUS EQU 3
RA EQU 5
RB EQU 6
RC EQU 7
BIJIAO EQU 0F
JIANZHI EQU 8
BUFFER EQU 9
BUFFER1 EQU 0AH
BUFFER2 EQU 0BH
COUNTER EQU 0CH
CON1 EQU 0DH
CON2 EQU 0EH
PIC57 EQU 7FFH
Z EQU 2
;-----------------------------
ORG PIC57
GOTO MAIN
;-----------------------------
ORG 0
;-----------------------------
; 延時(shí)子程序
;----------------------------
DELAY MOVLW D'100'
MOVWF CON1
L1 MOVLW D'200'
MOVWF CON2
L2 DECFSZ CON2,1
GOTO L2
DECFSZ CON1,1
GOTO L1
RETLW 0
;-----------------------------
; 4*4鍵盤(pán)掃描判斷子程序
;-----------------------------
SCANKEY
MOVLW B'11101111'
MOVWF RB
MOVF RB,W
ANDLW B'00001111'
MOVWF BUFFER
MOVLW B'00001111'
XORWF BUFFER,W
SKPNZ
GOTO XYB1
MOVWF BUFFER1
MOVLW 1
MOVWF JIANZHI
MOVF RB,W
MOVWF BIJIAO
GOTO QJZ
XYB1 MOVLW B'11011111'
MOVWF RB
MOVF RB,W
ANDLW B'00001111'
MOVWF BUFFER
MOVLW B'00001111'
XORWF BUFFER,W
SKPNZ
GOTO XYB2
MOVWF BUFFER1
MOVLW 5
MOVWF JIANZHI
GOTO QJZ
XYB2 MOVLW B'10111111'
MOVWF RB
MOVF RB,W
ANDLW B'00001111'
MOVWF BUFFER
MOVLW B'00001111'
XORWF BUFFER,W
本文引用地址:http://butianyuan.cn/article/171243.htm
DIY機(jī)械鍵盤(pán)相關(guān)社區(qū):機(jī)械鍵盤(pán)DIY
!--StartFragment-->;-------4*4鍵盤(pán)程序的使用--------
PC EQU 2
STATUS EQU 3
RA EQU 5
RB EQU 6
RC EQU 7
BIJIAO EQU 0F
JIANZHI EQU 8
BUFFER EQU 9
BUFFER1 EQU 0AH
BUFFER2 EQU 0BH
COUNTER EQU 0CH
CON1 EQU 0DH
CON2 EQU 0EH
PIC57 EQU 7FFH
Z EQU 2
;-----------------------------
ORG PIC57
GOTO MAIN
;-----------------------------
ORG 0
;-----------------------------
; 延時(shí)子程序
;----------------------------
DELAY MOVLW D'100'
MOVWF CON1
L1 MOVLW D'200'
MOVWF CON2
L2 DECFSZ CON2,1
GOTO L2
DECFSZ CON1,1
GOTO L1
RETLW 0
;-----------------------------
; 4*4鍵盤(pán)掃描判斷子程序
;-----------------------------
SCANKEY
MOVLW B'11101111'
MOVWF RB
MOVF RB,W
ANDLW B'00001111'
MOVWF BUFFER
MOVLW B'00001111'
XORWF BUFFER,W
SKPNZ
GOTO XYB1
MOVWF BUFFER1
MOVLW 1
MOVWF JIANZHI
MOVF RB,W
MOVWF BIJIAO
GOTO QJZ
XYB1 MOVLW B'11011111'
MOVWF RB
MOVF RB,W
ANDLW B'00001111'
MOVWF BUFFER
MOVLW B'00001111'
XORWF BUFFER,W
SKPNZ
GOTO XYB2
MOVWF BUFFER1
MOVLW 5
MOVWF JIANZHI
GOTO QJZ
XYB2 MOVLW B'10111111'
MOVWF RB
MOVF RB,W
ANDLW B'00001111'
MOVWF BUFFER
MOVLW B'00001111'
XORWF BUFFER,W
DIY機(jī)械鍵盤(pán)相關(guān)社區(qū):機(jī)械鍵盤(pán)DIY
評(píng)論