Keyboard Interfacing
Keyboard Interfacing
DAXINI
Instrumentation & Control Dept
AITS Rajkot
ORG 0X20
KEYPAD:
SETUP: MOVLW 0X0F
MOVWF TRISB ;Enable RB7-RB4 as output and
RB3-RB0 as input
BCF INTCON2,7,0 ;Enable pull-up resistors
MOVLW 0XFF ;Reading when all keys are open
MOVWF KYSOPEN
ORG 0X0
RESET_ISR GOTO MAIN ;Jump over interrupt table
ORG 0X08
HI_ISR BTFSC INTCON,RBIF ; was it a PORTB change
BRA RBIF_ISR ; yes than go to ISR
RETFIE ; else return
ORG 300H
KCODE0 DB 0,1,2,3 ; ROW 0
KCODE1 DB 4,5,6,7 ; ROW 1
KCODE2 DB 8,9,A,B ; ROW 2
KCODE3 DB C,D,E,F ; ROW 3