MCP23008 vs PCF8574 as 4x4 Keypad interface - interrupts
Ron Czapala
Posts: 2,418
Has anyone utilized the interrupt capabilities of these two chips (or their brethren)?
The Microchip site has an informative Application note regarding Interfacing a 4x4 Matrix Keypad with an 8-Bit GPIO Expander
The datasheet for the PCF8574 states that "Interrupts that occur during the acknowledge clock pulse can be lost (or be very short) due to the resetting of the interrupt during this pulse"
while the MCP23008 datasheet states:
Datasheets
MCP23008 http://ww1.microchip.com/downloads/en/DeviceDoc/21919e.pdf
PCF8574 http://www.ti.com/lit/ds/symlink/pcf8574.pdf
Any code examples using the interrupt capabilities of either chip would be appreciated.
I ordered one PCF8574 and several MCP23008 chips from DigiKey
The Microchip site has an informative Application note regarding Interfacing a 4x4 Matrix Keypad with an 8-Bit GPIO Expander
The datasheet for the PCF8574 states that "Interrupts that occur during the acknowledge clock pulse can be lost (or be very short) due to the resetting of the interrupt during this pulse"
while the MCP23008 datasheet states:
It's interrupt capabilities seem more robust since it is configurable using it's registers.The interrupt output can be configured to activate under two conditions (mutually exclusive):
1. When any input state differs from its corresponding input port register state, this is used to indicate to the system master that an input state has changed.
2. When an input state differs from a preconfigured register value (DEFVAL register).
Datasheets
MCP23008 http://ww1.microchip.com/downloads/en/DeviceDoc/21919e.pdf
PCF8574 http://www.ti.com/lit/ds/symlink/pcf8574.pdf
Any code examples using the interrupt capabilities of either chip would be appreciated.
I ordered one PCF8574 and several MCP23008 chips from DigiKey
Comments
http://forums.parallax.com/showthread.php/144862-My-First-ExpressPCB-order...-help-review-please!?highlight=4x4+keypad
The PCB in the above thread sort of grew out of this thread:
http://forums.parallax.com/showthread.php/143382-4x4-Keypad-Decoder-the-Hard-Way?highlight=keypad%20decoder
... I sent an extra board I had to Steve:
http://forums.parallax.com/showthread.php/146337-How-to-Wire-4x4-Keypad-to-work-with-PCF8574A-I-O-expander-chip?highlight=4x4+keypad
I may still have another if I can put my hands on it I can send it too you.
Doc
Thanks Doc!
I am leaning toward using the MCP23008 chip since I have used various versions of those in the past (both SPI and I2C).
I think the interrupt feature would allow you to scan the rows and columns only when an interrupt occurs rather than constantly scanning.
I may try the constant scan approach but thought he interrupt approach should be faster with the WAITPEQ instruction.
http://forums.parallax.com/showthread.php/155364-MCP23008-Keypad-Interrupt-On-Change-demo
Not yet. I just got the MCP23008 chips Monday and got it working this morning. My demo is just checking the interrupt pin every 5ms.
I have also wondered if power consumption might be affected...