Is it possable to a 4x3 keypad in this circuit

1Steveo

New Member
I'm running out of IO pins (16f675 14pin) and realy like to keep the lcd with out getting a serial one!

Thanks for looking

Steve
 

Attachments

  • lcdkeys.gif
    14.2 KB · Views: 1,120
Can you tell us what you need to hook up to the 14 pin PIC please?

2 pins - VDD and VSS
6 pins - LCD
1 pin - MCLR Reset?

What else?

Regards, Mike
 
well for a 4x3 keypad you would need 7 inputs according to Nigels toturials. that would be a problem if you have only 14 pins, im guessing u have got about 5 inputs right? i cant see your drawing well so i dont know. i dunno if its possible but u might be able to use the analoge input of the IC (if it has one) to tell the difference between the buttons pressed. if not then i dont know sorry
 
With reference to your diagram above,

Replace the 100R resistors with 1N4148 diodes pointing down.
Replace the switches with your 4*3 keypad.
The 4 row connectors go to the diodes.
The 3 column connectors go to 3 I/O pins.

In your initialisation software,
Initialise the 3 pins connected to the keypad to outputs and set them high.

To read the keypad,
Set the 4 data lines to input.
Set one of the 3 pins low.
Read the 4 data lines.
The value read is the column connected to the pin you set low. A zero = key pressed.
Set the pin high again.
Repeat for the other columns.
Set the data lines back to output.

By my counting, thats a total of 9 I/O pins needed.

HTH

Mike.
Edit, can't count.
 
Theoretically, you can do it all with one ADC pin...

check out this thread for a discussion that covers your situation:

https://forums.basicmicro.net/ShowPost.aspx?PostID=16556

This will also take you (eventually) to a Microchip site with tricks and tips for the PIC you may find quite useful.
Finding a commercial keypad to do this will probably prove impossible, so you may have to roll your own with 12 (16 if you want) switches on a proto board and an interconnectiong cable.

'Luck!
kenjj
 
I assumed he wanted to use this type of keypad.

**broken link removed**

Available everywhere.


Mike.
 
With a number of carefully selected resistors, you can make a unique voltage divider for each button on the keypad. You can then sample the voltage created using a single analog input pin and the A/D converter.

Here is an example with 8 discrete switches. You will have to adjust it to work with a matrix style keypad.

**broken link removed**
 
yes that is what i meant from my post above i think i may try this as it certainly does cut down on pins thank you.
 
GST_Nem said:
yes that is what i meant from my post above i think i may try this as it certainly does cut down on pins thank you.

There IS a way to wire a matrix keyboard so that every key gives a unique resistance, I'm fairly sure it's been posted on these forums previously?. I remember thinking it was rather clever!.

As long as you have a spare analogue input (or don't mind doing software A2D) you only need the one input.
 
what is software A2D? analouge to digital?? and what do u mean by that, because i think i might do this actualyl and i need all the info ic an get
 
GST_Nem said:
what is software A2D? analouge to digital?? and what do u mean by that, because i think i might do this actualyl and i need all the info ic an get

It's reading analogue values using a single digital I/O pin, check my joystick PIC tutorial for an example.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…