Another Keyboard thread

158 views
Skip to first unread message

Simon Walker

unread,
Jun 7, 2012, 1:38:07 PM6/7/12
to FIGnition
Just to let you know , my soldering skills from 25 years ago have not
let me down and I have a fully working Fignition !!!

The keyboard will take some getting used too. Will never say a bad
word against the ZX80 keyboard again !

Reading the threads on using a PS2 keyboard, I had a wild idea (please
if this is stupid let me down gently as I only have a ladybird book
understanding of electronics ). I took apart my "Tesco" PS2 keyboard.
This is fairly new membrane keyboard and connects via plastic sheets
with printed copper contacts to a tiny board which I assume is the
serial processor to convert the keys presses and send to the
computer. Since I assume this is matrix keyboard could the internal
keyboard motherboard be replaced with a simple (?) circuit to see if
a key on the matrix was pressed and send the signal down a wire
(one for each key in the matrix) and modify the keyboard case to house
the Fignition . A lot of wire's but is it a workable ? What type of
circuit would I require to add the shifted key press for the
Fignition ?

fig8r

unread,
Jun 8, 2012, 5:24:17 AM6/8/12
to fign...@googlegroups.com
Hi Simon,

There is at least one solution using the analog approach by Carl at RetroText, "Non PS2 fignition Keyboard":
http://retrotext.blogspot.com/2011/12/non-ps2-fignition-keyboard.html

I would consider a simple microprocessor like ATTiny, used in two ways:

1. Decode PS/2 interface

There are numerous approaches, e.g.
 - Arduino PS2Keyboard library 
    http://www.arduino.cc/playground/Main/PS2Keyboard
 - Propeller TinyTwoWire Module (ATTiny exposing I2C to any MCU)
    http://www.gadgetgangster.com/find-a-project/56?projectnum=333
 - Adding a keyboard to an Atmel ATtiny or ATmega
    http://avrprogrammers.com/example_avr_keyboard.php
 - AVR313: Interfacing the PC AT Keyboard
    http://www.atmel.com/Images/doc1235.pdf

2. Encode Fignition keyboard protocol

Based on The Keypad description
    https://sites.google.com/site/libby8dev/fignition/documentation/understand-it
And assuming that the 6 keypad pins are broken out to the board pins.

 - First, map input key code (ASCII or special scan code like Ctrl or arrow) to three bytes: (1) shift marker, (2) key 1: SW1-8 inverse mask, (3) key 2: SW1-8 inverse mask (SW1 in LSB)

 - if shifted, wait until PB0 is 0, hold PC0 in 0 for SW5, release PC0
 - for key 1: in a loop ~.5 sec
    - if PD7 is 0, set PC0-3 to low 4 bits of key 1 ("press" SW1-4)
    - if PB0 is 0, set PC0-3 to high 4 bits of key 1 ("press" SW5-8)
 - for key 1+2: in a loop ~.5 sec
    - if PD7 is 0, set PC0-3 to low 4 bits of key 1 OR low 4 bits of key 2
    - if PB0 is 0, set PC0-3 to high 4 bits of key 1 OR high 4 bits of key 2

To get more insight here's from "nocommercialpotential"
  - Reading C16 Keyboard - on handling keyboard matrices
    http://nocommercialpotential.posterous.com/reading-the-c16-keyboard-part-1-from-the-jaws
 - Interfacing the PS/2 Keyboard - on syncing reads (writes) with clock (mode key)
    http://nocommercialpotential.posterous.com/interfacing-the-ps2-keyboard

Oleg

Carl Attrill

unread,
Jun 9, 2012, 3:41:56 AM6/9/12
to fign...@googlegroups.com
Thanks for the mention fig8r :)

Simon, you have articulated the issues of the challenge perfectly, if you were to peruse the manual keyboard in the form of a PCB all the documentation should be on the blog to assist, I did some months ago try to make a PCB but I gave up, it would cost too much and the immanent breakthrough of the PS2 interface would render it moribund, however some time has past since then, could you or anyone help to make this PCB? we could then sell it as an add-on to the FIGnition.

fig8r

unread,
Jun 10, 2012, 8:41:39 AM6/10/12
to fign...@googlegroups.com
Here's a step towards FIGnition keypad encoder: Figgipad Sniffer - an Arduino sketch, which listens to top/bottom row keypad selectors on FIGnition, captures signal stats over 10k loop and sends them to PC over serial port.the keypad row selectors are PD7 for top and PB0 for bottom rows. So we connect
  Arduino-Figgy: Pin 3-PD7, Pin 2-PB0

The output sample is

Top Count(0)/Count(1) : Max(1),Count(->0) - Botton Count(0)/Count(1) : Max(1),Count(->0) : Time(us)

7981/2019 : 290,7 - 2019/7981 : 1234,7 : 110104
8051/1949 : 289,6 - 1950/8050 : 1234,7 : 110048
8269/1731 : 290,6 - 1731/8269 : 1234,6 : 110176
7979/2021 : 290,7 - 2020/7980 : 1234,7 : 110008
7980/2020 : 290,7 - 2019/7981 : 1234,7 : 110008

8271/1729 : 289,6 - 1731/8269 : 1234,6 : 110176
8146/1854 : 289,7 - 1856/8144 : 1234,6 : 110100
7980/2020 : 290,7 - 2019/7981 : 1234,7 : 110016
8080/1920 : 289,6 - 1920/8080 : 1234,7 : 110068
8270/1730 : 289,6 - 1731/8269 : 1234,6 : 110172

Analysis:

Period: 110ms/6.5 = ~20ms or 50Hz
Top Duty(0): 0.81      ( 8146/[8146+1854] )
Bottom Duty(0): 0.19   ( 1856/[1856+8144] same as 289 / [289 + 1234] )

Interesting how the duty cycles are asymmetrical.



figgipad_sniffer.ino

fig8r

unread,
Jun 10, 2012, 9:44:56 AM6/10/12
to fign...@googlegroups.com
Figgipad Sniffer Analysis (from earlier post):


Period: 110ms/6.5 = ~20ms or 50Hz
Top Duty(0): 0.81      ( 8146/[8146+1854] )
Bottom Duty(0): 0.19   ( 1856/[1856+8144] same as 289 / [289 + 1234] )

Compared to the attached scope views:

Period: 16.67ms or 60Hz
Duty Cycle Top(1)=Botton(0): 18.40%=0.184 (matches the calculation above)


Duty Cycle Top(1):


Top row, freq=60Hz:

Bottom row, period 16.67 ms


fig8r

unread,
Jun 10, 2012, 9:47:24 AM6/10/12
to fign...@googlegroups.com

Simon Walker

unread,
Jun 11, 2012, 8:33:19 AM6/11/12
to FIGnition
Fig8r

Thanks for detailed replay.Wow !

Told you my electronics knowledge was ladybird. There was me thinking
a PS2 keyboard was a simple push to make matrix, reading through the
links you provided, show this is not a simple mechanical problem of
detecting if an electrical contact is high or low.

This is way beyond my knowledge.

Trawling through the internet I did find this :-

http://www.willegal.net/appleii/appleii-kb-int.htm

This converts a PS2 keyboard to a ASCII keyboard. Would this simplify
the interface ? . I seem to remember the Amstrad Spectrums used a
ASCII keyboard on a ribbon cable to the motherboard.







On Jun 10, 2:47 pm, fig8r <ole...@yahoo.com> wrote:
> Bottom row, period 16.67 ms:
>
> <https://lh3.googleusercontent.com/-TCniGaAZxkE/T9SlTWStMeI/AAAAAAAAA6...>
Reply all
Reply to author
Forward
0 new messages