VKEY DEMO - A full keypad using only 4 keys and 1 or 2 fingers
Peter Jakacki
Posts: 10,193
There are times when I design a piece of equipment which needs a numeric keypad plus function keys for operator entry. This creates problems with mounting, I/O lines, and space constraints. I came up with this idea the other day of using 4 keys in quasi-binary fashion except no more than 2 fingers (V) are used to select a code. I built up a keypad and tried it all out and it is very easy to use. The basic idea is to have buttons labeled (4)+(2)+(1)+(0) where you can tap out these values plus combinations of them. Unlike a pure binary input this has a "0" key plus it uses the "0" key as a modifier to directly enter the digits 7,8, and 9.
Function keys are selected by holding down the key for around half a second where the keypad will timeout and generate a function code.
The actual code to "scan" the keys is very simple and reliable. Each key is connected to a port pin with a 10K pullup and the other end is grounded. This is something that I will be building into some industrial and commercial designs where full keypad input is desired but not practical.
You will find a four function calculator demo attached that outputs to an ANSI terminal like Teraterm or Hyperterminal. It's a bit rough but try it out.
Here's the actual VKEY encoder routine.
*Peter*
Post Edited (Peter Jakacki) : 3/16/2008 12:37:19 AM GMT
Function keys are selected by holding down the key for around half a second where the keypad will timeout and generate a function code.
The actual code to "scan" the keys is very simple and reliable. Each key is connected to a port pin with a 10K pullup and the other end is grounded. This is something that I will be building into some industrial and commercial designs where full keypad input is desired but not practical.
You will find a four function calculator demo attached that outputs to an ANSI terminal like Teraterm or Hyperterminal. It's a bit rough but try it out.
Here's the actual VKEY encoder routine.
' return with key code or 0 if no key pub vkey : key | latch if timeout == 0 repeat while (ina[noparse][[/noparse]s4..s0] ^ $0f) & $0F latch := 0 timeout := fnctime repeat key := (ina[noparse][[/noparse]s4..s0] ^ $0f) & $0F latch |= key timeout-- until key == 0 or timeout == 0 '0 1 1+0 2 2+0 2+1 210 4 4+0 41 410 42 420 421 4210 key := lookupz(latch: 0, "0","1","7","2","8","3","9","4","9","5",$0B,"6",$0C,"7",$0F) if timeout == 0 key |= $80 ' encode timeout keys with msb set
*Peter*
Post Edited (Peter Jakacki) : 3/16/2008 12:37:19 AM GMT
Comments
What I am doing now is building a small 16x2 LCD module into a TIC TAC box with a VKEY as a calculator and serial terminal. I can add alphas to the keypad in the same way they are added to phone keypads by repetitive key action. Drop in a small lithium battery, run the prop at lower speed to save power, add a simple RS232 interface and the whole thing fits into my coin pocket!
I also noticed that Parallax have a cheap board with a 2x8 LCD and four buttons which would make it even easier build.
*Peter*
LCD MODULE
www1.jaycar.com.au/productView.asp?ID=QP5519&CATID=&keywords=16+CHARACTER&SPECIAL=&form=KEYWORD&ProdCodeOnly=&Keyword1=&Keyword2=&pageNumber=&priceMin=&priceMax=&SUBCATID=
PARALLAX TERMINAL APPMOD
www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/Level/a/ProductID/53/Default.aspx?SortField=ProductName%2cProductName