And microprocessors were very expensive, so one processor had to do all the work.
![]()
Yeah, that's true. I designed a product during that time (a little earlier perhaps) that used the microprocessor to scan a 4 X 10 keypad array via the address bus because keyboard encoder chips were not quite available. It wasted 1024 bytes of the address space but only cost a couple of TTL chips to implement.
So, @kenkku , you should try this scheme for figuring out how the keyboard works. Take a look at the PDF that @MicroBahner to get the address of specific keys.
Word. The original Macintosh mouse presented the rotary encoder signals to the 68000 microprocessor on the logic board for processing.
But even way back then, the keyblade sent serially encoded key events, had its own scanning logic.
a7
Then the keyboard requires a constant stream of addresses (R, C) and takes OUT Low when the corresponding key is pressed ?
Anyone got a line open on this? I'll take a piece of that action. ![]()
a7
So if I understood correctly, as per the labeling on my breakout board I have wired pin 1 to 1, 2 to 2, etc. I have tried selecting a column with A1 and a row with A4. Here is my test sketch:
const byte input_OC = 9;
int testCol = 2;
int testRow = 5;
void setup()
{
Serial.begin(19200);
pinMode(input_OC, INPUT);
pinMode(testCol, OUTPUT);
pinMode(testRow, OUTPUT);
Serial.println("ready...");
digitalWrite(testCol, HIGH);
digitalWrite(testRow, HIGH);
}
void loop()
{
if (digitalRead(input_OC) == 0) {
Serial.println("Got a signal");
}
}
In Table 4.0 it says that the collector will be LOW when the key is down, but its always low.
Remember the input pull-up if you don't have an external resistor.
Sorry, I should have mentioned, I have tried that as well and its still reading LOW
You must press the addressed key to get an output. Try all the keys.
Reading constant low implies maybe a misswire as well.
I see that you have 2, 5 set H.
I wonder if the other 'address pins' need a L.
Yes, according to the schematic they are all pulled high.
OMG that actually did it! I'm getting a signal now!
Thank you everyone for your patience and insights, this was an awesome experience! I'll go get working on the software part now.
Thanks for presenting us with the challenge. I personally learned some things in the process.
A0 ... A6 are an address (the address of the selected key). All address inputs of the keypad must therefore be at the corresponding level (HIGH/LOW) in order to form the address and select the corresponding key. So you must connect all lines to the corresponding pin of the arduino and set all outputs correctly. Which one is row and which one is column isn't important in the end, as this is done internally by the keyboard. Only the complete address is important and the address of each key is shown in figure 4 of the pdf.
I'm quite shure, that the pin numbers in the pdf refer to the pin numbers of the connector on the PCB and NOT the the pin numbers of your DB15 connector. You have to check how the PCB connector is wired to the DB15 connector.
That was indeed the correct way to wire it, as it does work now, thank you again!
I also have this terminal keyboard and am looking to interface with it. It was very strange in my research to come across this topic only a few days old! Many thanks for all the work that I was able to put directly into use.
Using code similar to #66, I did my best to create a matrix as in post #32, assuming that pins 1, 2, and 3 were column pins, and 4, 5, 7, 8 were row pins. As far as I can tell, the 0 row and column are unused, also row 7 (0111). Furthermore, columns 5, 6, and 7 repeat columns 1, 2, and 3.
@kenkku does this track with what you're finding as well? Any ideas how I can process the data differently?
It does! My keys also repeat, for some bizarre reason. I tried addressing the repeating and "missing" keys individually and that yielded either them repeating the code or missing, however, I found that if you press one of the "faulty" keys and hold it down, then press a neighbor key and let go of the neighbor while still holding the "faulty" one, it suddenly starts sending the correct signal. I am not sure what causes this yet. Here is the code I have implemented for my keyboard:
const byte input_OC = 9;
const int kn = 28;
int pins[7] = { 8, 7, 5, 4, 3, 2, 1 };
char *keys[kn] = { "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "5E", "5F", "54", "57", "60", "61", "62", "64", "65", "63", "66", "67", "58", "59", "5A", "5B", "5C", "5D", "56", "55" };
char * hexToBinary(char input[])
{
unsigned int x = strtol(input, 0, 16);
static char buffer[8];
for (int i = 0; i < 8; i++) buffer[7-i] = '0' + ((x & (1 << i)) > 0);
buffer[8] = '\0';
return buffer;
}
void setup()
{
Serial.begin(19200);
pinMode(input_OC, INPUT_PULLUP);
for(int i = 0; i < 7; i++) {
pinMode(pins[i], OUTPUT);
}
Serial.println("ready...");
}
void loop()
{
for(int i = 0; i < kn; i++) {
char * binkey = hexToBinary(keys[i]);
for(int j = 1; j < strlen(binkey)-1; j++) {
digitalWrite(pins[j-1], (binkey[j] - '0'));
}
if (digitalRead(input_OC) == 0) {
Serial.print("Got a signal from ");
Serial.println(keys[i]);
}
}
}
I have a list of keys in hexadecimal that I then convert to binary and loop over to impress the address on the pins. I am going through the keys row by row starting from the top left.
Oh cool, are you using the diagram from page 14 of the manual posted earlier? How does that work, if each hex code is 8 binary digits and you're sending to 7 address pins?
I went through and did each binary address by hand, digitalWrite for each pin, upload, press every key until I got a hit. It was terrible, but I had tried the following code and it ended up giving me no address for some keys, and four addresses for others. I thought it was an issue with my code, but maybe it has something to do with your neighboring keys issue?
void loop() {
// Loop through rows
for(int row = 0; row < 8; row++) {
// Set row pins based on binary row address
digitalWrite(1, (row & 0x1) ? HIGH : LOW);
digitalWrite(2, (row & 0x2) ? HIGH : LOW);
digitalWrite(3, (row & 0x4) ? HIGH : LOW);
// Loop through columns
for(int col = 0; col < 16; col++) {
// Set column pins based on binary column address
digitalWrite(4, (col & 0x1) ? HIGH : LOW);
digitalWrite(5, (col & 0x2) ? HIGH : LOW);
digitalWrite(7, (col & 0x4) ? HIGH : LOW);
digitalWrite(8, (col & 0x8) ? HIGH : LOW);
// Check if Pin 9 reads LOW
if(digitalRead(9) == LOW) {
// Print x and y coordinate of the key pressed
Serial.print("Key pressed at: ");
Serial.print("row: ");
Serial.print(row);
Serial.print(" column: ");
Serial.println(col);
}
// Delay for stability
delay(10);
}
}
}
