Reading a keypad with an MCP23016
Here is a tidy little program that will let you read the state of a keypad having up to 16 buttons.· We used a 12-button keypad - BG Micro SWT1068.· Keypads must have a common ground with lines for each button.· All buttons are held high with a 10K resistor to Vdd.· The program contains all the connections for the MCP23016 and the keypad.· This is for a bus type keypad only - it won't work with a matrix keypad.
The program uses only two I/O ports - 8 and 9 - and has only·two 1-byte variables.· It is written for the BS2P, but I have a modified code for the BS2/BSE if you need it.· I used my MCP23016 piggyback but any breadboard configuration will work just as well.
·
Post Edited By Moderator (Jon Williams) : 4/12/2005 11:07:46 PM GMT
The program uses only two I/O ports - 8 and 9 - and has only·two 1-byte variables.· It is written for the BS2P, but I have a modified code for the BS2/BSE if you need it.· I used my MCP23016 piggyback but any breadboard configuration will work just as well.
·
Post Edited By Moderator (Jon Williams) : 4/12/2005 11:07:46 PM GMT
Comments
Add a schematic to this and post it under "Projects".· This project is very popular, thank you for posting this.
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
www.parallax.com
·
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com