RE: General calculation type question
Assuming your keypad is connected as
follows:
1
2 3
A
+
+ +
B
+
+ +
1,2,3,A,B are all I/O pins on the PIC. Tie A and
B high with resistor. Keep A and B with an output of '0'. In your
program, output a '1' on A. Read pins 1 then 2 then 3 and see which one
has a '0' value. This is the button that is pressed on A. If no
button (or '0' on a pin) then your program puts A back to '0', sets B to '0' and
scans 1 then 2 then 3 again looking for a '0'.
Normally I wouldn't recommend this exact circuit
because one input is directly sourcing another. But because of the low
duty cycle and the fact that a PIC can sink a couple of TTL loads, this has
worked for me on a number of occassions.
Don't
forget to allow some delays in your program for "key
bounce".
John
I know this is probably going to be a dumb
question, but I haven't been able to successfully read inputs from a
keypad. They keybad works by connecting 2 inputs TOGETHER when a key is
pressed on 6 pins. I know how to read a pin when its pulled high through
a resister out to V+ and if its low V-. But if they connect together
what am I supposed to do to read this state?
Anyhelp thanks.
Darren King