PDA

View Full Version : connecting a 4X4 keypad



fadibasic
- 25th April 2008, 07:46
Hi Guys,
I am looking in understanding how to connect a keypad to a pic16f877.
I have read a lot and I am starting to get confused. Some requires resistor and some require resistor and diode. can someone explain to me when do we need resistor and when do we use diodes?

precision
- 25th April 2008, 08:25
Best way to connect keyboard.

http://www.picbasic.co.uk/forum/showthread.php?t=3250

Hardware Connection
===================
1. Column bits must have Pull-up resistor attach to VCC
2. ROW bits must be connected in series with resistor.
.

Melanie
- 25th April 2008, 12:07
Actually there's no such thing as 'best way' to do anything... hmmmm... I suppose I can think of a few things, but I digress...

Technically, if you have a 4 x 4 keypad, you can link the columns to four PIC Pins and the Rows to four PIC pins, no Resistors, Diodes or anything else needed. The rest is creative software. However you DO need to use pins which have integral Pull-Up's. Typically, assigning PORTB on a 16F628, 16F876, 18F2420 (etc etc to name a few out of many) all do the job admirably.

fadibasic
- 25th April 2008, 16:00
Melanie,
What about pic16f877? and what do you guys mean by Pull Ups?

mister_e
- 25th April 2008, 16:15
Whatever the PIC you're using, you can use almost every I/O on it. The software must be done to work with your own assignment. Not much.

PIC16F877A have internal pull-up which can be enable by software... but they're on PORTB ONLY. No problem if you don't need any feature available on PORTB. Just hook your keypad on PORTB, use

OPTION_REG.7=0 ' Enable internal pull-up on PORTB
and away you go.

Explanation of pull-up.
http://www.seattlerobotics.org/encoder/mar97/basics.html

Melanie
- 26th April 2008, 09:33
By the kind of question you've asked, it looks like you're not too experienced with PICs. Yes, 16F877 is fine, if you checked you'd discover it has a PORTB and if you look at the Datasheet (which you can freely download from the Microchip website - and is a MUST!!!) you will discover that PORTB on that PIC also has pull-up's. All a pull-up is, is a Resistor internal to the PIC, which you can program the PIC to switch-in if you need it. That Resistor connects between the relevant PIC pin and Vdd (+ve supply rail) pulling that pin up to +ve (hence the name). Just saves you having to provide one externally.

proper
- 12th November 2008, 18:52
hi dude...

thanks for posted the link...

that helps me to clear the idea of knowing hoe to connect the keyboard effectively:)