Matrix keypad controller?
Jimmy W.
Posts: 112
I have been shopping around for a while on matrix keypad controllers, it looks like most of i2c devices that are "application appropriate" according to specs
wont really fit what I need, the problem is they supply an /INT line but as soon as the button is released int resets and they do not have registers that record
the origin of the interrupt( I don't have time to read it in time, if I press for a bit longer than what a normal key press is I am able to read it, and long before
a second key press could happen), I have looked at the simple spin object in OBEX but the problem remains the same, I don't have time to service the keypad
in time to do the cross reference to detect the exact key,and on top of that I don't really have the pins to dedicate to that. I have found this device STMPE2401
( www.st.com/stonline/stappl/productcatalog/app?path=/pages/stcom/PcStComGenerateTableView.onClickOfRPN&primaryheader=Logic%2C%20Signal%20Switches&secondaryheader=Xpander%20Logic&subclassheader=Xpander%20Logic&subclassid=1027&rpncode=154805&producttype=product&open=product&applilevel=)
but it is only available in BGA ATM with other form factors being in the preview stage. My real question is this, has anyone had any experience with an i2c io
expander that is similar to the STMPE2401 in that it has a register for what the key pressed was, I only need 16 buttons so even if it was a 16 io expander and
each input was direct, as long as it had a register that recorded the interrupting key.
Sorry for the long post, your combined experience is much appreciated.
Jimmy
Edit: corrected formatting
wont really fit what I need, the problem is they supply an /INT line but as soon as the button is released int resets and they do not have registers that record
the origin of the interrupt( I don't have time to read it in time, if I press for a bit longer than what a normal key press is I am able to read it, and long before
a second key press could happen), I have looked at the simple spin object in OBEX but the problem remains the same, I don't have time to service the keypad
in time to do the cross reference to detect the exact key,and on top of that I don't really have the pins to dedicate to that. I have found this device STMPE2401
( www.st.com/stonline/stappl/productcatalog/app?path=/pages/stcom/PcStComGenerateTableView.onClickOfRPN&primaryheader=Logic%2C%20Signal%20Switches&secondaryheader=Xpander%20Logic&subclassheader=Xpander%20Logic&subclassid=1027&rpncode=154805&producttype=product&open=product&applilevel=)
but it is only available in BGA ATM with other form factors being in the preview stage. My real question is this, has anyone had any experience with an i2c io
expander that is similar to the STMPE2401 in that it has a register for what the key pressed was, I only need 16 buttons so even if it was a 16 io expander and
each input was direct, as long as it had a register that recorded the interrupting key.
Sorry for the long post, your combined experience is much appreciated.
Jimmy
Edit: corrected formatting
Comments
There are other I2C I/O expanders that just provide an 8-bit or 16-bit expander. A simpler expander would
require the Propeller to do the scanning itself. Any particular reason to not use a separate cog for this? Are
you tight on I/O pins as well?
I've used the Microchip (MCP23017) and Philips expanders (PCA9554, PCA9555, and PCA8574). They all seem
to work as advertised.
http://www.nxp.com/#/pip/pip=[noparse][[/noparse]pip=PCA9555_7]|pp=[noparse][[/noparse]t=pip,i=PCA9555_7]
You could configure 8 IO as a 4 x 4 key matrix and still have an additiomal 8 IO left over.
Cheers.
I am actually using 2 MCP23017's as Io expanders right now for my LED's and to control my hd44780.
The problem is I only have 2 cogs left to work with after the 4 port serial driver, ethernet, SD, etc 1 is going to be parsing
serial and Xbee data and running the show and the other will be servicing my i2c bus, (ds2482 x8,io expanders, lcd) and
taking the data the 1 wire sensors give it and parse it back to the main cog. the way I have written it if that second cog sees
the interupt pin go low it will service it when it comes back from whatever it is right in the middle of as soon as possible, alot
of the time though this is not soon enough and the interrupt has already cleared (once the pin resets to the state it was last serviced in)
I am looking for something similar (as the stmpe2401will not be available in PQFP for at least 2 more months) because the stmpe2401 has
a register that records what the press was (13.7 of the data sheet) up to 3 events.
As for available pins I am now using 31 of the available 32 pins on the prop itself, as well as IO expanders
Hope this information helps and thanks for the response Mike.
Thanks,
Jimmy
it in time to read the key before it gets released
does this mean you have already all 8 cogs working on timecritcial tasks with no time left for a fast checking ?
how about using monoflops that will make the pulse as long as you deserve it ?
another idea could be to use 2 cascaded 8bit shift-registers with parallel input serial output that has a latch like the 74xxx597.
The latch could be triggered after a small time after the pressing of the button by an RC-based circuit.
Then the latch-trigger has to stay locked until you send a reset-signal.
This would take three IO-lines: clock, serialdata and reset "latch-trigger-ciruit"
If you have only two IO-Lines left all this bitbanging could be done by an I2C-IO-expander
or you put an I2C-io-expander on non-timecritical other IO-lines to win back more direct IO-pins of the propeller
best regards
Stefan
It has been a fun project and I have learned a lot so far,
but simple it will not be, I originally planned on using 4 props, and that
number slowly dwindled as parts got specified and code got realized,
written and optimized, this is my last major challenge and I look forward
to it. If I end up not finding a suitable component I may throw a basic stamp
or SX in there to get some extra parallax points [noparse]:)[/noparse]
Thanks Mike, I appreciate your input, and value your comments [noparse]:)[/noparse]
Jimmy
Any IO expander could be used, but you do not need the interupt.
You can scan the IO lines in a 4 x 4 matrix and if a key is pressed then the value of that key can be put into a variable that can be polled i.e. not zero then a key code is available.
If have some well documented assembly language (not prop) that shows the process flow if you are interested.
Cheers
here I was going high tech, should have gone back to the basics you are a genius, as it is If I pressed the button I JUST missed
the data read but LONG before the next key press, this a a great idea, thanks Stefan!