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: 2009/11/21 04:52,
38.107.191.102:LOG IN
|
| ©2009 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? Please DO link to this page! Digg it! <A HREF="http://www.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? |
|
Ubicom SX18 thru SX52, PIC 16c5X compatibile, 50 to 75 MIPS microcontrollers! |
|
The only consistant, simple to use yet powerful development environment. It simulates real-world devices via virtual component "plugins" (LED,LCD,key,motor,TV,etc) in real time, has a syntax highlighting editor, macro assembler and disassembler. Regular updates and third-party plugins keep this software ahead of any other PIC IDE. |
.