Keypad Module question

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
I searched for a datasheet of 4X4 Matrix Keypad Module on the internet but I could not find any datasheet. I am looking some good documents to understand 4X4 Matrix Keypad.

I know everything is available on the internet As i like this page 4X4 Matrix Keypad

Will you suggest any good material that explained very well about 4X4 Matrix Keypad ?
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
There is a good tutorial on programming the Keyboard and explanation to prevent error when two keys pressed etc.
It is for assembly programming but the C code is also out there.
http://www.winpicprog.co.uk/pic_tutorial9.htm
Max.
I saw that page But still I don't understand clearly

What is meaning of following paragraph posted link in first post

First test whether any key is pressed down. Connect power to rows, so they are High level. Then set all the rows Y1-Y4 as Low and then detect the status of the columns. Any column of Low indicates there is key pressing and that the key is among the 4 keys of the column. If all columns are High, it means no key is pressed down.
Next, locate the key. Since the column in which the pressed key lies is identified, knowing the line would finalize the testing. Thus, set the rows as Low in turns until any is unveiled accordingly – other rows will still be High


I think I should make a table for this

Y1Y2Y3Y4X1X2X3X4 Descriptions
00000111
00001011
00001101
00001110
 
Last edited:

MrChips

Joined Oct 2, 2009
30,706
What part of this you do not understand?
We can make it clearer for you.
It would help if you drew a circuit diagram.
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
What part of this you do not understand?
We can make it clearer for you.
It would help if you drew a circuit diagram.
I want to connect the keypad to microcontroller pic16f877a

I do not understand logic to scan a matrix keypad. I read we check out raw and column to detects button press How do we know which button is pressed .
 

MrChips

Joined Oct 2, 2009
30,706
It doesn't matter what MCU you are using to connect to the keyboard.
The first thing you need is a circuit diagram.
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310

jpanhalt

Joined Jan 18, 2008
11,087
I believe it is using a "Sunfounder Uno" board. That uses a different chip than you plan to use. I suggest you simply understand the way the switches are connected to allow one to read rows and columns. Then draw a schematic based thereon. The schematic posted by Max has rows and columns reversed.
This circuit is given in that link But i' have doubt because there's no resistor with buttons
We do not know that the whole circuit is for that board. It is likely that there may be weak pull-ups or something else on that particular board. The MCU you plan to use has weak pull-ups, so you may not need resistors.

In any event, I see this thread getting very confusing until you show the schematic you plan to use, including all connections to the chip you are using.
 

MrChips

Joined Oct 2, 2009
30,706
The basic principles are the same. You need to establish what those principles are.

You need four connections to rows R1 - R4.
You need four connections to columns C1 - C4.
One group of four will be connected to outputs of MCU.
The other group of four will be inputs to MCU.
Which are the inputs and which are the outputs?

The inputs must have either pull-ups or pull-downs, not both.
If the MCU can provide weak pull-ups then you do not need external resistors.
 

John P

Joined Oct 14, 2008
2,025
MrChips has it right. If you're still having trouble, make a drawing of a single switch connecting a single row and a single column, then think about what happens when you push the switch.
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
MrChips has it right. If you're still having trouble, make a drawing of a single switch connecting a single row and a single column, then think about what happens when you push the switch.
I have used to buttons and one led. led doesn't turn on if any button pressed

1578240791991.png
 

John P

Joined Oct 14, 2008
2,025
That's a totally different circuit. You had a PIC16F877A and now it's an LED?

An LED won't do much in series with 10K, anyway.
 

jpanhalt

Joined Jan 18, 2008
11,087
I have used to buttons and one led. led doesn't turn on if any button pressed
This thread seems to be drifting. Are you still interested in the original question? How (e.g., which Port) will you connect to the 16F877A? PortB has WPU's for all pins and interrupt-on-change for 4 pins.
 

MrChips

Joined Oct 2, 2009
30,706
Here is a push-button switch S1 connected to two pins, P1 and P2, on the same MCU.
What are you going to do with this?

MCU Switch interface.jpg
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
Here is a push-button switch S1 connected to two pins, P1 and P2, on the same MCU.
What are you going to do with this?
your diagram is confusing

you mean something like this

1578275011386.png

Here is a push-button switch S1 connected to two pins, P1 and P2 of MCU where the P1 and P2 is input pins but I have seen we connect one end of switch to power and another end to ground.
 
Top