- Discrete LEDs
- Dot/Bar LEDs
- Matrix LEDs
- 7-Seg LEDs
- Serial -- Software
- Serial -- Hardware
- RS-232 via the MAX3232
- I2C -- EEPROM
- I2C -- DS1307 Real Time Clock
- 1-Wire -- DS18B20, Powered, Single-Drop
- 1-Wire -- DS18B20, Powered, Multi-Drop
- 1-Wire -- DS18B20, Parasitic, Multi-Drop
- TI Link Protocol -- Calculator Demo
- Infrared Communication
- MIDI -- Output Demo
- MIDI -- Input Demo
- MIDI to Analog Synth
Keypad -- Matrix Type
Here we go with a little fancier input, a 4X3 keypad affair. These look much like you might see on a telephone. This particular unit is arranged in a matrix switching topology. Pressing a button shorts a row and column together uniquely. I picked this guy up from All Electronics several years ago.
As you can see in the photo, above, both the row and column are indicated on the LCD for learning purposes, as well as the key-translation.
The circuit is a snap. But notice how the row-drive pins of the PIC are shared by the LCD. This is do-able because the LCD and keypad are never addressed simultaneously.
There's nothing too tricky in the code. But you might pause to read it over and see how the library unit (for the LCD) and a procedure are used. Also observe how the row and column are detected, and how this intersection is turned into an ASCII keycode. PIC Micro Pascal makes these sorts of operations easy; moreover, the source code is exceptionally self-documenting.
Click to get the source code.
Click to get the schematic PDF.
Next Project: Keypad -- One-Wire