Image Map Image Map
Page 3 of 7 FirstFirst 1234567 LastLast
Results 21 to 30 of 64

Thread: Arduino keyboard emulator host wiring.

  1. #21

    Default

    Okay, it would seem that the key board doesn't control the TouchTone. That makes more sense. There need to be more wires going to the keyboard than we see on the schematic. the ones not shown would be strobes to ground. You need to tell us which wires are not going to the 4051s and where they go.
    Dwight

  2. #22

    Default

    I figure, you need at least 7 more strobe wires from someplace. Maybe they are from the logic board schematic.
    Dwight

  3. #23

    Default

    You need to tell us which wires are not going to the 4051s and where they go.


    I started doing that 4 months ago and gave up because I didn't have the schematic then. I traced the whole keyboard circuit using my 'foil coated sponge' method and managed to draw up this spreadsheet. http://binarydinosaurs.co.uk/paKeyboard1.xlsx
    I stopped at Z67 because that chip is under what you see labelled as the 'emulator' which is in charge of all I/O in the machine. Thanks to the schematic of that I can now see that X0-X7 are ports on the emulator's 6541AQ microcontroller so I can get a logic analyser on it to see what happens when I press the keys on my little microswitch keyboard.

    I've renamed the schematics so they're easier to follow:

    http://binarydinosaurs.co.uk/tandata...s-analogue.jpg
    http://binarydinosaurs.co.uk/tandataPASchematics-digital.jpg
    http://binarydinosaurs.co.uk/tandata...s-emulator.jpg (this is the I/O module)
    http://binarydinosaurs.co.uk/tandata...ervadongle.jpg
    http://binarydinosaurs.co.uk/tandata...matics-ram.jpg (optional RAM module I don't have)

    Nearly 1am here so time to hit the hay. Cheers!
    www.binarydinosaurs.co.uk - UK home computer history
    Where RIFA capacitors come to die
    facebook.com/binarydinosaurs

  4. #24

    Default

    I'm not able to see the digital schematics but that is OK, your spread sheet looks to have the basis of what you need. One side of the switches will go to the two 4051s. The other side will go to a device that pulls that side to 0 when it is being strobed. Your keyboard emulator needs to watch these strobes and when one matches the set of switches on that line with the mapped switch from the PS/2 keyboard, you pull down the appropriate signal to the 4051. The only issue you might have is that if you are busy reading data from the keyboard, you might not stop driving the line to the 4051 in time to keep from stepping into the the next strobe. This might be seen as the next key being selected by the PA. If you look at the protocol for the PS/2 keyboard, you can stall signals from the keyboard by pulling the clock low ( I think, you better look that one up ). The key board will buffer any change in the keys ( most keyboards can buffer 8 events but you shouldn't be gone that long ).
    It still may be an issue. Most are designed to sample on the negative edge of the strobe, so as long as the strobes are slow you should be OK. Hopefully you can read the keyboard status between a full sweep of the strobes.
    I believe it is possible on the blue pill to connect a input pin to enable a DMA of data to a pin. That way you'd only have to load the DMA buffer with the current keyboard value that would DMA to the output pins. The DMA would handle the strobe. The Arduino board may also have such feature but I'm not familiar with the features of the chip they use. The blue pill only has 16 ea 5V compatible pins so you may need to make voltage dividers for the strobe inputs on another port's pins. I'm not sure how many DMA channels there are though. An interrupt system may be the way to go. That would help to isolate the PA side from the PS/2 keyboard while reading the PS/2 data stream.
    These are all details you'll have to work out. First you need to look at the rate that the PA strobes the scan. My calculations say you need at least 7 strobes the 4051's have 15 inputs. You also need to see how fast the keyboard clocks the its data. Some key strokes from the PS/2 keyboard are multiple bytes. A release of a key can be 3 bytes long, as I recall.
    One other thought, does the PA consider the right and left shift to be different keys? The PS/2 does. It is annoying as the one side is two bytes for the down stroke.
    There is one feature of the PS/2 keyboard you can take advantage of. I believe you can remap all the keys, as I recall. That may save some time.
    I've never looked to see what the PS/2 keyboard clock timing was on my PS/2 to parallel because I set my blue pill to run at 72Mhz. It is much faster than the keyboard clock.
    Dwight

  5. #25

    Default

    Sorry for the delay, I got waylaid by an NEC PC8201A that someone mentioned had a rechargeable battery in so priority became replacing that and cleaning up the small amount of spillage then getting the machine working again, which it now does

    I've realised tonight I've been coming at this keyboard from exactly the wrong way around, purely because when I first drew out the circuits (pre having the schematic) I was going from keyboard pins inwards to R6541A microcontroller and not the other way which is how it should be. The R6541A strobes the select pins of Z3/Z4/Z5 and controls the INH pins of Z4 and Z5 to select which chip is in use. (Z3 has the INH pin permanently low because it has its own select pins whereas Z4/Z5 share). A hit on pin 3 means a key has been pressed so I need a lookup table to match whichever PS2 key has been sensed at that point in time.

    I think. Keyboard scanning is new to me but that makes sense.

    Cheers!
    www.binarydinosaurs.co.uk - UK home computer history
    Where RIFA capacitors come to die
    facebook.com/binarydinosaurs

  6. #26

    Default

    I looked back at my keyboard understanding. It seems I got it backwards.
    The 4051s, Z4 and Z5, are output strobes to scan the keyboard. This would come back on KBSENSE. This would generate a KBINT from Z6, through Z3. I would guess each key has two switch contacts or diode matrix. Each would common to KBSENSE.The processor would sample the X0 to X7 to determine which line of the 4051s, Z4 and Z5, were active during a key press. Multiple hits would indicate the needed debounce time. Pin 1 of Z5 would create a KBINT that might not have valid key press detected. This would be used to keep track of when key scan completed, with or without a key press.
    I hope I got that right.
    Dwight

  7. #27

    Default

    Quote Originally Posted by Dwight Elvey View Post
    I looked back at my keyboard understanding. It seems I got it backwards.
    The 4051s, Z4 and Z5, are output strobes to scan the keyboard. This would come back on KBSENSE. This would generate a KBINT from Z6, through Z3. I would guess each key has two switch contacts or diode matrix. Each would common to KBSENSE.The processor would sample the X0 to X7 to determine which line of the 4051s, Z4 and Z5, were active during a key press. Multiple hits would indicate the needed debounce time. Pin 1 of Z5 would create a KBINT that might not have valid key press detected. This would be used to keep track of when key scan completed, with or without a key press.
    I hope I got that right.
    Dwight
    I got it wrong again. I see that the connectors between Z3 and Z6 are the feedback from the keyboard. There would be no need for diodes. It looks like there would be 120 possible keyboard keys this way. It is all making sense. The thing that was confusing me is that the 4051s are bidirectional. It took me a while to figure what was involved. I was also a little confused by Z2's part in the keyboard scan but realize it was not involved.
    Z4 and Z5 would generate a one signal high to the keyboard( assuming VB is a negative voltage ). Any key that was pressed it would cause one input of Z6 inputs to go high. This would cause a KBINT on pin 15 of Z6. The interrupt would then cycle through the combinations of X0 to X1 to find the active bit selected as seen on KBSENSE that the processor could monitor, through Z3 pin 3. It would already know which combination of Z4 and Z5 was selected. The rest is just taking X3 through X7 combined with the KBSENSE setting of X0 to X3 as a table lookup address to determine the character of the keyboard.
    I hope I didn't confuse things too much.
    It might be good to measure the rate that X3 to X7 are toggling. I would suspect X3 is the fastest. This will determine if you can drive the signals to Z6 directly or use some type of decoder and latch to hold the data. You will also need an Adruino with 25 pins if you intend to more directly connect to the PA. You'd need 2 pins to connect to the PS/2 keyboard for clock and data. making the total of 25 I/Os.
    That would be 15 inputs, 8 outputs and 2 open-collector bidirectional.
    Using external circuits, it is possible to combine the 15 pins down to just 4 pins and the 8 outputs to 3. This would make 4+3+2 = 9 pins. If using an Arduino Maxi I believe you should have enough pins. It still depends on how fast X3 to X7 are being toggled. You need to detect a change on the signals from Z4 & Z5, compare with a possible key from the PS/2 keyboard and broadcast it on the 8 lines to Z6, before Z4&Z5 have a chance to change. You also need to remove the data fast after Z4&Z5 change or it could be a miss detect of the next cycles key. If the signals are regularly changing, it is possible to predict the next Z4&Z5 change. This might be the better method. Do note that I suspect the times may change some once Z6 has detected a key down.
    Code wise, you'd need to convert the 15 signals to a table address. This address would index a table containing the bit to send to Z6.
    In the background, you'd need to monitor the PS/2 keyboard for any key change of state. This is a lot of activity while watching the Z4 & Z5 signals. I believe it would be best to decode the Z4 & Z5 signals in hardware outside of the Arduino.
    Instead, it might be better to have two Adruinos. One to keep track of the PS/2 keyboard and another to detect a match of the Z4 & Z5 signals. This would allow each to cleanly handle each action, separately.
    You could have one external IC, like a 74LS244 to enable the keyboard data at the right time to Z6. I'd use two Blue Pills myself but that is up to you.
    I see this as a simple arrangement. The PS/2 keyboard would output a 8 bit value to the input of the 74LS244 as the one bit code to the Z6. It would also output a 4 bit value for the Z4&Z5 watching chip to match up with. When it saw a match, it could send an enable to the 74LS244 to drive the data to the Z6 lines.
    Dwight

  8. #28

    Default

    We're almost right I think, I'd completely overlooked Z6 and was puzzling why my analyser only shows a trace when a key is pressed - Z6 is strapped as an OR gate so if any of the 9 inputs fires it generates KBINT and the microcontroller starts scanning.
    First it inhibits Z4 (pin 6 high) and samples Z5, then inhibits Z5 and samples Z4, then samples Z3 which has its inhibit pin (6) strapped low. I can see this on an analyser trace.

    The keyboard itself is pairs of switch contacts, yes, and both outputs form DTMFEN. Pin 1 of Z5 probably has something to do with the phone side of things too, it seems to be further controlled by a signal called VSW which I don't have a source for but given the number of times it appears on the digitial circuit I'd not be surprised if it was for the power switch.

    This is the trace for me pressing the LEFT key which on the matrix is SK6-3 and SK6-10, those lines end up at Z3-12 and Z4-2.

    Screen Shot 2019-04-18 at 20.01.59.jpg

    You can see the inhibit pins on CH3 and CH4 blocking access to Z4 and Z5, and you can see both KBINT and KBSENSE drop when the LEFT key is detected. The CBA select pins are correctly at 110 and 011. That's what I need to replicate. Fun task for the easter break!
    I now need to test that theory on the other 6 keys I have available...
    www.binarydinosaurs.co.uk - UK home computer history
    Where RIFA capacitors come to die
    facebook.com/binarydinosaurs

  9. #29

    Default

    Gah, and I've realised that when I mapped out the keyboard I had it upside down compared to the schematic so all my key coordinates were backwards. Now that I've amended the spreadsheet the layout suddenly makes SO much more sense, with the X portion being the pins that are pulled low that go to Z3 and the Y portion being the pins that are pulled high going to Z4 and Z5.
    www.binarydinosaurs.co.uk - UK home computer history
    Where RIFA capacitors come to die
    facebook.com/binarydinosaurs

  10. #30

    Default

    Now I think we are getting it. The interrupt sorts which of the 8 lines by scanning X0 to X2. That would send the value to KBSENSE.
    I just couldn't figure out how it was getting so many pins with so small a matrix. Then I realized what it meant by SK6/7. That was the return input from the keyboard.
    Dwight

    There is still something that doesn't make sense. The VB is a positive voltage??
    Dwight
    Last edited by Dwight Elvey; April 18th, 2019 at 12:47 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •