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.
Matrix Keypad Interface Using I2C
Matrix Keypad Interface Using I2C
- 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