View Full Version : switching multiple switches
I'm trying to make an alternative number keypad for a computer that uses an old rotary telephone dial (plus a few switches) to input the digits and number pad keys. I'd never used pics before and only have a basic understanding of electronics but I managed to interface to the dial and read in the dialled number with only a couple of hours fiddling.
The next problem is to send the dialled digit out to the computer. I realise that emulating PS/2 with a picaxe is not practical so I plan to hack the circuit board from a pc keyboard. PC keyboards have a large matrix (something like 12 x 10) of switches and the usual keyboard hack is to short a row and a column together to simulate a keypress. I won't need to use that many rows and columns for the number pad but there could be a few. What do I use to simulate an array of keys, and how should I control it. I've only used a picaxe 08m so far, which one would I need to drive this?
Thanks very much
Tim
Is it sufficient to simulate just a single key press at a time?
wilf
premelec
17-01-2006, 05:59
The rotary dial simply has number of closures at a pretty slow speed [I used to dial rattling the hook switch :-)]. You'll need some sort of de-bounce circuit for the mechanical contacts and then count with the PICAXE.
Rough ideas here...
The next part of the situation is a bit more complicated but I think it would be possible to use two multplexers 8 in 1 out like a 4051 to form an 8x8 cross connect switch to patch into a keyboard... depends on how the keyboard is actually set up but perhaps this can give you some idea... You can connect the 4051s to a shift register which will take pulses from PICAXE to clock appropriate data to make the cross point connection. And hit the reset pin on SR to go again... depending on how fast you can load the SR and how fast the keybaord responds you may need a hold off or SPST switch to hit the keyboard matrix with the final 'position'.
Your rotary dial counting program needs to have some fast cycling to look for dial start and then some interval time to know to look for next digit and store the last one or whatever you want to do.
Good luck...
Stan. SWAN
17-01-2006, 09:13
Yikes - a rotary dial computer sounds pretty ancient indeed! I recall something similar about - <i>mumble </i> -1971, back when Bill Gates was still on the way to his first $1k. Why the need to use it ?
Just for the record as a result of your initial comment, the Picaxe 18A & X have great PS/2 keyboard interfacing features. Yeah right- now get your steam computer to recognise the eventual serial output... See => www.picaxe.orcon.net.nz/keyb18xa.jpg <A href='http://www.picaxe.orcon.net.nz/keyb18xa.jpg ' Target=_Blank>External Web Link</a> with code =>www.picaxe.orcon.net.nz/keyb18xa.bas <A href='http://www.picaxe.orcon.net.nz/keyb18xa.bas' Target=_Blank>External Web Link</a>
Edited by - Stan. swan on 1/17/2006 8:17:50 AM
You asked for it Moker:
a Picaxe controlled AT keyboard that simulates the closing of a single key "contact" in an 8x8 keyboard controller key scan matrix which then sends the corresponding scancode to the PC PS2 or USB connector.
AT keyboards usually have a custom layout and you probably have to experimentaly determine the X/Y coordinate each key value where X = 1 of 8 encoder inputs and Y = 1 of 8 encoder scan line outputs.
The selected X and Y coordinate results in two 3 bit codes which are combined into a 6 bit KeyValue. In this case, the KeyValue corresponds to one of (17?) numeric keypad keys but up to 64 values are possible.
The 2 wire keyboard simulator shown here
http://www.user.dccnet.com/wrigter/picaxe/2wire%20keyboard%20simulator.gif
uses two analog 1 of 8 multiplexers to select and connect 1 of 8 encoder scan lines to 1 of 8 encoder inputs. The multiplexers are adressed by a counter which is set to the selected keyvalue by pulsing the CLK line with Picaxe output pin0. The multiplexers are enabled (contact closes) with Picaxe output pin1.
When a "key" needs to be sent to the PC, the Picaxe load the corresponding KeyValue into the counter by calling the 2wire1 subroutine.
The 2 wire interface uses a 6 bit counter that is incremented to the selected key value (63 max) by generating 10us positive pulses on CLK Picaxe pin0. Next the selected key "contact" is enabled by bringing the ENABLE line (picaxe pin1) LOW for the minimum debounce period. Then the CLK line is pulsed high for 100us to reset the counter.
This cheap and dirty 2wire SPI counter design can be used for other applications such as a character LCD. Use a 74HC590 counter with output register and tristate outputs if you need to avoid spurious output states.
wilf
---------partial listing -------
;Picaxe 8 to 2 wire counter based SPI
;wilf rigter - Jan 17, 2006
SYMBOL CLK = 0 ; Picaxe 8 pin0
SYMBOL ENABLE = 1 ;Picax 8 pin1
SYMBOL KeyValue b0 ;0-63 value selects key
INIT_2WIRE: ; initialize 2WIRE interface
CLK LOW ; positive clock pulses
ENABLE HIGH ; disable key
PULSOUT CLK, 10 ; reset counter to zero
RETURN
2Wire1: ;transfers keyvalue to counter
;KeyValue=0 on RETURN
IF KeyValue > 0 THEN 2Wire2
ENABLE LOW ; enable selected key
PAUSE 100 ; 100ms debounce
ENABLE HIGH ; disable keys
PULSOUT CLK,10 ; reset counter
RETURN
2Wire2:
PULSOUT CLK,1 ; increment counter and
KeyValue = KeyValue-1 ; loop until
GOTO 2Wire1 ;counter = KeyValue
--------- end of listing -----------
Thanks Wilf, thats pretty much exactly what I would have had in mind, if I knew what I was doing.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.