Simple Button Keypad – Microcontroller
Simple method for creating a custom button keypad that doesn’t require separate hardware. Just your microcontroller buttons a few resistors.
What we have here is 9 buttons and 6 signal lines (3 inputs, 3 outputs). The basic setup is in a grid pattern where the three input lines come down as columns (PIN0, PIN1, and PIN2), and the three output lines come across as rows (PIN3, PIN4, and PIN5).
Each button is a momentary ON button, normally open. So what will happen is when we press the button it will make a connection between that button’s input and output, other wise there is no connection.
The key here is in the software.
What the software is going to do is sweep between the inputs and outputs, for every combination very fast. I will outline the steps for 1 input, and then it simply repeats the same steps for each other input.
For input on PIN0
— PIN0, 1, 2 defined as outputs
— PIN3, 4, 5 defines as inputs
1. Set PIN0, PIN1, AND PIN2 to LOW
2. Set PIN0 to HIGH
3. Check if PIN3 is HIGH or LOW, IF HIGH go to function SW1
4. Check if PIN4 is HIGH or LOW, IF HIGH go to function SW4
5. Check if PIN5 is HIGH or LOW, IF HIGH go to function SW7
6. Set PIN0 to LOW
This will then repeat with the only differences being which input pin is set to HIGH, and the names of the SW functions its going to.
For more detail: Simple Button Keypad – Microcontroller
From Schematic to PCB Production, Just Need One Tool
Free Circuit Design Software: learn to use Editor quickly and easily
Cheapest PCB: 10pcs 2-layers 10cm×10cm only $8.21, 3-day build time, 100% E-test
Current Project / Post can also be found using:
- simple keypad and lcd interfacing in pic16 microcontroller