Thursday 21 September 2017

The Keypad.

So, as far as is possible from the available information, I've got a fair idea how the display, game select and sound works.

We're left with the keypad. We have three unused input lines IN1,2 and 3 and several output lines.

So obviously there's going to be some sort of matrix using the input lines ?

Well, nope, there isn't. If you look at the PCB you will see the IN 0 1 2 and 3 tracks. They are the 5th and 6th from the left. IN0 , which is the 5th from the left on the top, is connected to the display connector and a pull down resistor.

The other three form a "mini bus" of three lines, which head up the right side of the board - you can see them between the two connections of the ground line for the display connector, to the right of "REV 0 3".

This had me baffled for a while. There's a connector up there, which looks to be about four pins, which isn't used for anything. The keyboard connector is the seven pin one roughly dead centre, this is below the MCU chip. If those lines ended up there you'd see it on the component side.

What I noticed when reading the COP444 database is this chip has two serial interfaces. The second one is called "Microbus" and uses the IN1,2 and 3 lines. In this mode these become the strobe lines and data is passed in and out using the L-lines. I'm guessing here, that this is some sort of debugging, or testing system, or even maybe an expansion system ?

This still leaves us with the inputs. By a process of elimination, the only thing that the keyboard can be connected to is L ; D + G just aren't available electronically - physically on the PCB. L is handily placed and there are some resistors which look like they might handily connect to the keyboard connector (more obviously in the prototype).

There is a problem though. L lines are either inputs or outputs, but they are all inputs or outputs - so INL (input L) appears to switch everything to inputs. To put a matrix keypad on L we need some inputs and some outputs.

The trick is I think that it is possible to use the outputs as pullups for the inputs, but only if you use the Low current Tri-State "L" output (type e). The output types are set at ordering time.

EN2 needs to be set and importantly the Q latch lines need to be set to logic '1'. So I think these are controlled individually - the pull ups are connected through a matrix to high impedance inputs  which are a type of output that doesn't operate as a pull up so it reads the pull up or pull down, depending on the connections through the matrix, this gives us a 4x4 matrix, which we can read by only putting one pull up on. The resistors may well provide a pull down for the lines where the pull ups are not activated, but a pull up will override a pull down voltage level wise ; it is a sort of output.

There are seven connectors on the keyboard cable. There are four directions, numbered 1-4 a fire button, a skill button and a 1/2 player button.

There appear to be no diodes, so the usual keypad problem of pressing 2 keys at once can create spurious inputs will occur.

I'm presuming therefore that there are four seperate input lines for 1-4 which take up one pull up line, three seperate lines for start, skill, and 1/2 player detected by a second and one on its own for fire. Because fire is the only button connected to an input, it operates independently.



So , completely arbitrarily really (mapping 1-4 onto bits 0..3 is kinda logical), but the rest .... well it's an educated guess.

L7 set to pull up

Key 1 (Up) : L0
Key 2 (Right) : L1
Key 3 (Down) : L2
Key 4 (Left) : L3

L6 set to pull up

Start : L0
Skill : L1
Players : L2

L5 set to pull up

Fire : L0

No comments:

Post a Comment