have talked about the CP-1252/ASN-128 before Hacking The Navigation Computer Display. I have changed my mind about using a ps2 decoder to interface with the keyboard. I will write my own. It's about 30 lines of code, not including Scanner.h (prototypes) and Matrix.h which describes the 2 dimension array for the keyboard.
The Switches where made by Clare Pendar (Now Visualux) Pn: S180 11D5F4 and are very pricey. Thankfully I have about 3 of these units in various stages of disrepair so parts thankfully are not an issue.
Analysis: The Keyboard consists of 14 STDP switches, they also have a light keycap. They are arranged in three columns where the outside columns have 5 switches each and the middle column has 4. Each switch has pins 1 and 2 jumpered together forming an SPDT switch.
|
|
- First I used a DVM to check which yellow wire went where, as you can see in the table below.
- But the blues where a mess but junk box comes to the rescue. I had remains of an old project that had some led mounted on a header connected to a resistor pack. Now this will do. So I just connected the 4 LEDs to the blue wires on the two connectors (W5P1 & W5P4) and put 5 volts and the rest is history, as you see the table below.
This is the first cut off my keyboard scanner as you can see I have not included anything for de-bounce, etc. if scan() returns an alphanumeric character we are good to go. If scan() returns -1 then nothing there.
PS give a break with the code I know there are some errors here but you get the idea.
scan.c |
---|
/* * CP-1252.scan.c * * Created on: Oct 16, 2018 * Author: Harrison */
#include "Scanner.h" #include "Maxtrix.h"
char scan () { int state; char varchar = -1; int row =1; int col;
// Start rows in known state for (row = 1; row < 5; row++) { digitalWrite( row, HIGH);}
// Seach for a row + col do { for ( col=1; col <=4; col++ ) { if ((state = digitalRead(col)) == HIGH) { break;} else { varchar = Matrix[row][col]; }}} while( row < 5 ); retrun( varchar); |