Well, that was a bit of an adventure…
I created a command queue, so that anything coming into the serial port would be added to it, and then executed one character at a time. The next command in the queue would then be decoded once the previous one had finished. I then created a routine to decode the commands and turn them into key strokes on the virtual keypad.
The virtual keypad is basically a two dimensional array. The first dimension is the currentS, and the second is whatever key on that line you want to press. Keypad[currentS] [Key]. For instance, if I wanted to press the ‘5’ key, I would set keypad to true. If I wanted to reset the Tape Counter, I would set keypad to true (see keypad diagram in previous post.) The routine keeps that key down for as short a time as possible, then automatically sets it back to false again.
Once I had that all worked out, in theory, I started to do some testing. That’s when things got a little weird…
The first thing I tried to do was reset the Tape Counter. The machine went into rewind. I then hit the Search Zero key. Nothing happened. I then entered ‘111,’ and the Locate Time changed to ‘00001.’ I tried ‘321’ and the Locate Time changed to ‘01321.’ That last command made me sit back and scratch my head. I had to really think about all of those commands, and their results. Why had that last one worked, but none of the previous? Then I twigged…
First of all, the damn schematic is wrong. It doesn’t use S values of 0, 1, 3, and 4. It uses, the way more normal, 0, 1, 2, and 3. That made my brain feel better anyway. Once I changed that, I tried the Tape Counter Reset, and it worked like a charm. I hit Search Zero, and off it went back to ‘00000.’
Second of all, I had neglected to add a little ‘off’ time between key strokes. When I had entered ‘111,’ the machine only saw it as one long keystroke. I added a couple of cycles of all keys off at the end of each command execution and, bam!, it all worked well. Silly me. Didn’t even think about that.
On my last attempt, the machine started to ignore a few keys. Specifically the ‘0, 8, Search Zero, and Store 2’ keys. That is all of the keys on the S0 line. After looking at everything, and double checking the logic of my code, I have come to the conclusion that there is an intermittent connection within the MTR-12 itself on that line. I don’t think this machine has ever had a remote control attached to this port, so it isn’t surprising that there is an unknown fault in that section. I will track that down and fix it.
With the known fault, I did the testing for the video without needing to hit any of the S0 keys. In the video, I use the ‘A’ for the Search key, and the ‘B’ for Locate Time Reset. When I enter ‘321A,’ I am really saying ‘321 Search.’ When I enter ‘342-A,’ I mean ‘342, change it to negative, Search,’ so the machine scoots off to -0.03.42. When I hit ‘BA,’ it is basically the same as Search Zero.
Check it out.