Shop OBEX P1 Docs P2 Docs Learn Events
Typewriter Interface — Parallax Forums

Typewriter Interface

SciNemoSciNemo Posts: 91
edited 2010-09-02 12:24 in Propeller 1
I have an old electronic typewriter that I am trying to modify to type on it's own with input over serial.

There are 16 pins coming from the keyboard. I have an Arduino that I hooked up to all 16 pins for key mapping. I have discovered that if pins 1-8 are held high one of the other 8 pins (9-16) will go high as well. Pins 9-16 have diodes that prevent them from being held high by the original microcontroller (I think that is what they would do since they are facing toward the micro in the circuit).

The problem is this: How do I use a propeller connected to just those 16 pins to fake a key press? As a test I tried faking a spacebar press by holding pin 1 high and pin 3 low (which is the combo for that character), but to no avail. Is there some reason the original microcontroller wouldn't be fooled by this? Is there another way to do it that doesn't involve lots and lots of relays?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Not the fish.
sites.google.com/site/bitwinproject/

Comments

  • Nick MuellerNick Mueller Posts: 815
    edited 2009-06-23 18:44
    > Is there another way to do it that doesn't involve lots and lots of relays?

    Analog switches. wink.gif
    A keyboard matrix generally works that way:
    sequentially, a signal is set on every row and the processor checks in wich column that signal reapears. So setting some input to L or H won't help. You'd have to read the scans on the row and react by setting the column high.

    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • LeonLeon Posts: 7,620
    edited 2009-06-23 18:51
    30 years ago people used to modify IBM Golfball typewriters for use with their TRS-80 computers, and other machines. It involved several relays controlled by the printer port, IIRC.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • SciNemoSciNemo Posts: 91
    edited 2009-06-23 18:52
    @Nick:
    That makes sense, but does it mean that it is impossible for me to do it with just the propeller chip? Seems to me that checking for the host micro to send out a signal on the right pin and then putting the corresponding pin high would be too slow.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/
  • ericballericball Posts: 774
    edited 2009-06-23 18:56
    http://en.wikipedia.org/wiki/Keyboard_technology http://www.dribin.org/dave/keyboard/one_html/

    You might be able to have the Propeller listen to the input lines and then pull the correct output lines to create "virtual" keypresses. Although there'd be some latency, which the keyboard controller might not handle.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: http://forums.parallax.com/showthread.php?p=800114
    NTSC & PAL templates: http://forums.parallax.com/showthread.php?p=803904
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-06-23 18:58
    Hello SciNemo,

    did you measure voltage-levels and current on all the lines when the keyboard is connectec to the original MCU ?

    I guess the original MCU does set for example set one columm high and then looks which row is high
    in correlation to the columm set high

    you have to analyze if this is the case and which pins are used as outputs and which as inputs
    and at what frequency the ouput-pins are switched

    to emulate the keyboard the propeller will have to listen to the output-pins and set the correlated
    input-pins (of the keyboard) high to emulate the keypress

    how many keys does the keyboard have ?

    brs
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-06-23 19:00
    > Seems to me that checking for the host micro to send out a signal on the right pin and then putting the corresponding pin high would be too slow.

    Not necessarily. If you do have a scope, find the output lines of the keyboardcontroller and check its timing. It might be something in the 1 kHz to 10 kHz range (wild guessing). And that would work with the propeller.


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • SciNemoSciNemo Posts: 91
    edited 2009-06-23 19:30
    Well I have no access to a scope, so i guess i'll have to take a stab in the dark.

    This may seem like a stupid question, but how would I write a little chunk of assembly code that would check if one pin is high and if it is pull another pin high as long as the first pin is high? This is a little beside the point, but how do you check whether pins are high or low, and how do you set them high or low, in Spin?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-06-23 19:43
    > and how do you set them high or low, in Spin?

    I would do that in Assembler. SPIN might be too slow. But have a look at the waitXXX commands.


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • localrogerlocalroger Posts: 3,452
    edited 2009-06-23 19:56
    You could probably do this with one of the counter timer modules in apin = bpin mode; if you set apin to the column and bpin to the row, bpin will track apin towithin 1 clock cycle. You could even set apin and bpin in spin.
  • BADHABITBADHABIT Posts: 138
    edited 2009-06-23 20:05
    SciNemo said...
    Well I have no access to a scope, so i guess i'll have to take a stab in the dark.

    yOU MIGHT BE ABLE TO USE THE d-SCOPE OBJECT IN THE obex

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    BH skull.gif
  • SciNemoSciNemo Posts: 91
    edited 2009-06-23 20:31
    I couldn't find the d-scope object in the obex.

    I have this so far for an asm routine to check a pin and set another high.

    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      
    
    PUB go
      dira[noparse][[/noparse]0]~~
      dira~
      
      cognew(@asm_entry, 0)
        
    DAT
    
                  org
    
    asm_entry     mov       dira[noparse][[/noparse]0], dira
                  jmp       #:asm_entry
    
    



    I know dira[noparse][[/noparse]0] and dira is incorrect, but I have no idea how to do that in asm. But besides that what I think this does is set pin 0 to output, pin 1 to input, and then sets pin 0 to whatever pin 1 is. Is that right? How do I do the dira[noparse][[/noparse]0] and dira part?

    UPDATE: I just tried this code out:

    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    PUB go
      dira[noparse][[/noparse]0]~~
      dira~
    
      repeat
        dira[noparse][[/noparse]0] := dira
    


    And it worked smilewinkgrin.gif it appears that Spin is indeed fast enough to catch the original micro's query signal and route it to the correct pin to fool it.

    This speed may not stay around with added code, so my other questions still stand.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/

    Post Edited (SciNemo) : 6/23/2009 8:58:15 PM GMT

  • kwinnkwinn Posts: 8,697
    edited 2009-06-24 04:53
    This sonds like a typical 8x8 matrix keyboard. 8 lines are are made high (or low) one after the other in turn, and the other 8 lines are read to see if one goes high (or low) this gives a row/column address when a key is pressed.

    To replace the keyboard with a prop receiving serial data you need to know what row and column that character is on, and when the correct row reads high the prop outputs a high to the corresponding column.
  • SapiehaSapieha Posts: 2,964
    edited 2009-06-24 05:12
    Hi SciNemo.

    If it is old Teletype style Typewriter with mechanical control it is posible that TGB wast diode matrix decoded.
    In that decoding every column signal was decoded by diodes directly to one BAUDOT else in newer ASCII code by diode matric on its ROW.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • SciNemoSciNemo Posts: 91
    edited 2009-06-24 20:40
    I've figured it all out. I am using this chunk of code to emulate keypresses:

    PUB type( letter ) | iPin, oPin
    
      if  letter<126 and letter>31
        letter -= 32 'lowest value key press will now be 0
         
        iPin := Combos[noparse][[/noparse]letter]   'get the pin the typewriter pulls high for the given letter
        oPin := Combos[noparse][[/noparse]letter+1 ] 'get the pin the typewriter is expecting pulled high for the given letter
         
        dira[noparse][[/noparse]iPin] := dira[noparse][[/noparse]oPin]
        pause.pause(100)
        dira[noparse][[/noparse]iPin] := 0
          
    DAT
    
    'the pin the typewriter pulls high is listed first 
    Combos byte 0, 1
    



    Combos is a list of the pin combination for each key, in ascii order. Right now it only contains space, but I've mapped the other keys. The 16 pins from the typewriter micro that interfaced with the keyboard are connected to pins 0-15 of the prop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-06-25 10:43
    Glad u got it working. Just curious, what brand old typewriter is it?
    I used to modify electronic typewriters to work with microcomputers.
    Some of the brands were Royal, Olivetti, and Canon.

    humanoido
  • SciNemoSciNemo Posts: 91
    edited 2009-06-25 13:41
    It is a Correctronic GX-6000 Electronic Typewriter.

    I just tested some new techniques using an atmega168 and managed to get it working with that. The new setup has the typewriter modified with a serial port on the side that allows my propeller to communicate with the mega168 inside which converts all the data sent to it to emulated key presses that the typewriter picks up and types out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/

    Post Edited (SciNemo) : 6/25/2009 1:50:36 PM GMT
  • kwinnkwinn Posts: 8,697
    edited 2009-06-25 14:45
    SciNemo, just keep in mind that these electronic typewriters are not meant to be heavy duty printers. I used an IBM selectric on an early S100 system and went through several "golf balls" before switching to a Dataproducts Daisy wheel printer (Model D50 or D55 I think).
  • SciNemoSciNemo Posts: 91
    edited 2009-06-25 16:27
    I am using the typewriter for art, so it really won't be doing all that much printing. My idea is to use the propeller attached to an SD card or connected to the computer to take pictures and print them out on the typewriter in ascii.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-06-26 07:05
    It should work good for light duty use. The old IBM Selectric Type Balls always seemed to go out of alignment. Mechanically speaking, that's when the units were passed over to the mechanics expert. On the electronics side, electronic typewriters have Daisy Wheels do get some wear and tear, being made of plastic. Usually what happens first is the print hammer will stick when the diasy is rotating at high speed and a petal or two will break off. To prevent that from happening, periodically apply a light duty lubricant recommended by the manufacturer to the print head solenoid. The dry modern silicone lubricant can substantially improve the reliability of this system.

    humanoido
  • josiahjosiah Posts: 1
    edited 2010-09-02 12:24
    What you need is 16 outputs (or two outputs and two 8-bit SIPO shift registers) and 8 transistors. Solder together the emitters of the trans in parallel. Now when you pulse a high into the base, you will let the high ground to the common ground. At the same time, pulse a high into the return matrix from the Micro.
Sign In or Register to comment.