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 02:53, local time: 2020/9/30 17:30,
|©2020 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://piclist.com/techref/microchip/4x4key8io.htm"> PIC Microcontroler based Keyboards 4x4 Keypad Standard Scanning with 8 io pins</A>
|Did you find what you needed?|
PICList 2020 contributors:
o List host: MIT, Site host massmind.org, Top posters @20200930 Bob Blick, RussellMc, madscientistatlarge, Jason White, Neil, David C Brown, Sean Breheny, Harold Hallikainen, James Cameron, Allen Mulvey,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to piclist.com!