Ken Webster says:
I just happened to have an example [of a keyboard to PIC interface]. It is for a 4x4 keypad connected to a 17C756 on PORTB. It doesn't do the fast scan ... just a plain old one-row-at-a-time scan. I had PORTB (output latch) set to 0. Weak pullups were enabled.Pinout is kinda funky (to make PCB layout easier):
6---(1)-(2)-(3)-(A) | | | | 7---(4)-(5)-(6)-(B) | | | | 5---(7)-(8)-(9)-(C) | | | | 2---(*)-(0)-(#)-(D) | | | | 3 4 0 1 ;------------------------------------------------------------ ;Called by interrupt handler to scan the keypad ;Returns with W=ASCII if a key is pressed, W=0 otherwise ;Interrupt handler performs debounce SCAN1 MOVLW ~0X40 ;Enable ROW0 output MOVWF DDRB NOP NOP BTFSS PORTB,3 RETLW '1' BTFSS PORTB,4 RETLW '2' BTFSS PORTB,0 RETLW '3' BTFSS PORTB,1 RETLW 'A' MOVLW ~0X80 ;ROW1 MOVWF DDRB NOP NOP BTFSS PORTB,3 RETLW '4' BTFSS PORTB,4 RETLW '5' BTFSS PORTB,0 RETLW '6' BTFSS PORTB,1 RETLW 'B' MOVLW ~0X20 ;ROW2 MOVWF DDRB NOP NOP BTFSS PORTB,3 RETLW '7' BTFSS PORTB,4 RETLW '8' BTFSS PORTB,0 RETLW '9' BTFSS PORTB,1 RETLW 'C' MOVLW ~0X04 ;ROW3 MOVWF DDRB NOP NOP BTFSS PORTB,3 RETLW '*' BTFSS PORTB,4 RETLW '0' BTFSS PORTB,0 RETLW '#' BTFSS PORTB,1 RETLW 'D' RETLW 0
file: /Techref/microchip/4x4key8io.htm, 2KB, , updated: 2005/8/11 01:53, local time: 2024/12/22 11:27,
3.15.10.104:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/Techref/microchip/4x4key8io.htm"> PIC Microcontroler based Keyboards 4x4 Keypad Standard Scanning with 8 io pins</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.