The S Channel Inputs

S channel circuit schematic

The ‘S’ channel (lines S0, S1 and S2) is the main digital control channel for the auto-locator. It controls the timing for both the displays and the keypad. It is so important to the way the system functions, I am going to say that the ‘S’ must stand for ‘Supreme Commander.’

Warning: we are about to get into some digital truth tables, so brace yourselves…

The resistors and capacitors on the three lines serve as spark protection and pull up for the digital lines. The pull up is there to force the lines to go into a HIGH state if nothing is connected to them (floating inputs.) We will just ignore that stuff for now. I assume, maybe unwisely, that the processor on the Arduino has some form of spark protection anyway.

The lines then hit IC 3 and 4, which are SN74LS14N chips. These are Hex Schmitt-Trigger Inverters. That means that they clean up the signal coming in and make it consistent. It also means that they flip the logic coming in.

S Input     Inverter Output
HIGH        LOW
LOW         HIGH

Then the lines go into IC 9, which is an SN74LS138N. This is a 3 line to 8 line decoder. If we think of a HIGH state as a 1, and a LOW state as a 0, this is what happens with the outputs of the decoder:

S Input Inverter Output Decoder Output
S2 S1 S0 S2 S1 S0 0 1 2 3 4 5 6 7
1 1 1 0 0 0 0 1 1 1 1 1 1 1
1 1 0 0 0 1 1 0 1 1 1 1 1 1
1 0 1 0 1 0 1 1 0 1 1 1 1 1
1 0 0 0 1 1 1 1 1 0 1 1 1 1
0 1 1 1 0 0 1 1 1 1 0 1 1 1
0 1 0 1 0 1 1 1 1 1 1 0 1 1
0 0 1 1 1 0 1 1 1 1 1 1 0 1
0 0 0 1 1 1 1 1 1 1 1 1 1 0

These decoder outputs are used to activate whichever part of the displays and keypad that the MTR-12 wants to send information to, or get information from. Each output activates a single thing, except for outputs 3 and 4, which activate a digit in the display and a part of the keypad at the same time. Here is what that looks like.

S Input Inverter Output Decoder Output Activates
S2 S1 S0 S2 S1 S0 0 1 2 3 4 5 6 7
1 1 1 0 0 0 0 1 1 1 1 1 1 1 Keypad
1 1 0 0 0 1 1 0 1 1 1 1 1 1 Keypad
1 0 1 0 1 0 1 1 0 1 1 1 1 1 Sign Digit
1 0 0 0 1 1 1 1 1 0 1 1 1 1 Hour Digit (and Keypad)
0 1 1 1 0 0 1 1 1 1 0 1 1 1 Ten Minute Digit (and Keypad)
0 1 0 1 0 1 1 1 1 1 1 0 1 1 Minute Digit
0 0 1 1 1 0 1 1 1 1 1 1 0 1 Ten Second Digit
0 0 0 1 1 1 1 1 1 1 1 1 1 0 Second Digit

I will be dealing with the keypad at a different time, so only the digit activation parts are of interest to me at this point. If I remove all of the stuff between the inputs and what it is they activate, this is what I end up with:

S Input Activates
S2 S1 S0
1 1 1
1 1 0
1 0 1 Sign Digit
1 0 0 Hour Digit
0 1 1 Ten Minute Digit
0 1 0 Minute Digit
0 0 1 Ten Second Digit
0 0 0 Second Digit

I have a strong feeling that the S channel will just be continuously scrolling backwards through all 8 possibilities from 7 to 0, or in binary 111 to 000, and then starting over again. This should give us a forward scrolling in the decoder outputs. I should be able to see it doing this with a little Arduino code. It will be doing this very quickly, but that shouldn’t be a problem for the Arduino. The MTR-12 is older technology, and I would be very surprised if it is changing the S channel faster than, say, 10 kHz. The Arduino runs at 16 MHz, so it should be able to make some toast and have a little nap between the cycles of the MTR-12.

When the S channel changes, I want the Arduino to drop whatever it is doing and respond to the change immediately. The best way to do this is to assign a change in the S channel to an interrupt on the Arduino. If I look at the table above, it becomes apparent that, if I am correct about the scrolling, the line that will change every time the MTR-12 moves to the next number is the S0 line. I want to keep things as lean and simple as possible, so I will just attach the S0 line to a hardware interrupt on the Arduino. I will do this by using Digital pin 2 for that line, because it is one of the pins that can do a hardware interrupt, and adding the following code to the setup() routine:

attachInterrupt(digitalPinToInterrupt(S0Pin), decodeS, CHANGE);

This says to the Arduino every time the S0 line changes state, call the decodeS() function, which I will add to make sense of the three lines on the S channel and show me the result.

The setup() and loop() functions look like this:

void setup() {
Serial.begin(115200);
pinMode(S0Pin, INPUT);
pinMode(S1Pin, INPUT);
pinMode(S2Pin, INPUT);
attachInterrupt(digitalPinToInterrupt(S0Pin), decodeS, CHANGE);
}

void loop() {
}

There is nothing in the loop, because I only want it to do something when the S0 line changes. I am going to create an integer variable called currentS. When the line changes, the decodeS() routine will read all three S lines and store the decoded result into this currentS variable. It will then show me the currentS variable through the serial port. Think of the currentS variable as which decoder output is activated.

Testing:

Perfect. Exactly as predicted. Tomorrow, I will move on to doing something useful with this information.

 

 

Leave a Reply

Your email address will not be published.Required fields are marked *