Pages

Thursday, January 10, 2013

MCP23008 IO Expande - Interrupt control


Posted by Picasa

Now I am looking at the keypad interrupt timing, to see why the keypad test function is not working as expected.

I now understand why INTCAP stays even I released.  The reason is that when INCAP is read, the key is still pressed, therefore INT remains.  Perhaps I can try reading INTCAP repeatedly, every 5 mS, say, until INT deactivates (hopefully, INTCAP also reflects that). 

If INTCAP also goes back to original state when key is released, then it is not necessary to use the INT pin and can just use INTCAP to check if key is released.

.END

PS - I also found another application note AN1081 which actually discusses how to use MCP23008 to interface a keypad.  However, the design swaps IO during the key scan.  Unforunately my level shifter is unidirectional, and therefore cannot swap IO.  So this application note is not very useful, but still educational.

AN1081 INTRODUCTION

This application note discusses interfacing a 4x4 matrix keypad with MCP23X08 8-Bit GPIO Expander. This application note references the MCP23X08/17 GPIO Expander Keypad/LCD Demo Board (GPIODMKPLCD).
GPIO Expanders provide easy I/O expansion using standard serial interfaces such as I2C™ and SPI. They are especially useful in applications where pin count is limited on the microcontroller unit (MCU) or if remote inputs / outputs (I/O’s) are needed. It is best to think of an 8-bit GPIO Expander like adding another 8-bit wide digital port to the MCU.
.END

 

No comments:

Post a Comment