Matrix Keypad Interface Using I2C

Here you can share completed projects or parts of projects that may be useful to others. You may post files relevant to ZBasic - source code, schematics, etc.
Post Reply
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Matrix Keypad Interface Using I2C

Post by dkinzer »

I've created an example of how to connect a matrix keypad to a ZX using a PCF8574A I/O expander on the I2C bus. If you have other I2C devices already attached, the keypad can be added without using any additional I/O lines.

The circuit schematic for the connection and example source code are attached. The code implements auto-repeat but does not handle "multi-key rollover". It implements a polling technique but you could use the interrupt output of the PCF8574A to implement an interrupt-based interface. I haven't thought through how you would implement auto-repeat in this case but it could probably be done using WaitForInterval() to implement the check for the key-still-down condition.
Attachments
i2c_matrix_keypad.jpg
Interface Schematic
(39 KiB) Downloaded 5019 times
i2c_matrix_keypad.zip
Keypad Interface Source Code
(2.9 KiB) Downloaded 4919 times
- Don Kinzer
Post Reply