Not continuous scan, it just go through maximum one cycle at each press and when reach to the pressed button, the system goes to hold / inhibit status.
Here's an LTspice simulation of the NAND gate circuit with write-up here.
Only the output with the last pressed switch is active.
Each output, with an added transistor driver, or a driver IC such as the ULN2803, can control a relay.
The circuit can be extended to 16 outputs by duplicating the right portion of the circuit consisting of a diode, two resistors, and two NAND gates.
When you press a button, the diode-AND wiring pulls the Reset input to all of the other ff's low, clearing whichever one was latched at the time. It also pulls both the Set and Reset low for the ff for that button. When you release the button, the Reset input goes high immediately, but the Set input is held low by the time constant of the 1 M resistor and the input's capacitance. This delays the release of the Set input, leaving the ff in the Set state. Sounds a bit iffy, but the Wally has checked it out and he says it's reliable.
When you press a button, the diode-AND wiring pulls the Reset input to all of the other ff's low, clearing whichever one was latched at the time. It also pulls both the Set and Reset low for the ff for that button. When you release the button, the Reset input goes high immediately, but the Set input is held low by the time constant of the 1 M resistor and the input's capacitance. This delays the release of the Set input, leaving the ff in the Set state. Sounds a bit iffy, but the Wally has checked it out and he says it's reliable.
Because the output is taken from the gate with the Set input, it changes the instant the button is pressed. The trick is that it reliably stays set when the button is released.
Not continuous scan, it just go through maximum one cycle at each press and when reach to the pressed button, the system goes to hold / inhibit status.
I worked through the logic. I now understand your scanning scheme, and I edited my previous response. However, at 2 ms per scan it is possible for switch bounce to confuse things.
It doesn't.
It's designed to have only one button pushed at a time.
But if more than one is pushed, the last one released will be the only one selected to stay latched.
This delays the release of the Set input, leaving the ff in the Set state. Sounds a bit iffy, but the Wally has checked it out and he says it's reliable.
I believe it is reliable, but if there is a timing problem, a small capacitor added to each input after the resistor to give more delay after the reset goes high, should solve it.
It doesn't.
It's designed to have only one button pushed at a time.
But if more than one is pushed, the last one released will be the only one selected to stay latched.
Then I don’t think that satisfies the design objectives. The switch is used to switch midi signals (5 ma current loop).
So only one output should energize regardless of the number of buttons pressed...that is why I proposed earlier using a priority encoder approach.
Being a part time musician myself, I would want switching to occur immediately when the button was pressed...but it’s up to the TS..
Going back through the thread, I don't see any schematics using priority encoders. Did I miss something?
Separate from that, it is almost impossible for a radio button circuit to anticipate and capture correctly every possible mis-key input scenario. Often when two keys are pressed at the same time, the intended output is for the one held down the longest, even if it wasn't the first one pressed. Wally's latches the last button released, mine takes a snapshot of all buttons at the end of the debounce period for the first one pressed, others do other things. For my circuit, if you extend the debounce time period to however long someone sliding from the wrong key to the right one takes to be stable on only the intended key, the output never has simultaneous ON circuits but is delayed maybe 100-200 ms. Wally's response is much faster, but you will see both keys until one is released.
Anyway, there’s always a chance that more than one button gets pressed....how.?...,it happens...someone loses their balance moving about equipment and places their whole hand across some buttons...for example.
Or just simply fat fingers the buttons.
But...I believe the TS stated that requirement in their first post...
It’s a current loop (in and out jacks) carrying digital signal channel info so it will end up being garbage. Probably momentarily cutoff sound of the attached instruments.
Each Midi device has an "In" and "Out" jack and devices are "daisy changed" by connecting the output of one device to the input of the other device. The relays will be switching one output jack to 1 of 16 input jacks.
Here is the midi interface spec:
Here's a version using priority encoders.
I only showed 5 relay outputs in the graph because I was lazy . The outputs are shown energizing in a sequencial manner but can be selected randomly. The simulation is running with 20ms of bounce duration for each switch. The daisy chained CD4532B's only allow one input to be read at a time and present a 4-bit address (via U3) at the input to U5 . The differentiator circuit at the clock input of U4B provides the de-bouncing and triggers FF U4B to strobe U5 at each button press, causing U5 to latch the selected output. U4A sets all U5 outputs to zero at power up and latches to remove the INH signal when the first button is pressed. The circuit requires 7 chips though. I think it could be expanded fairly easily if desired.
I get all of that, but that wasn't my point. The right side of C7 (the differentiation capacitor) jumps up and down with every flutter of a button press. Since a differentiator is an edge extractor (enhancer?), it is the opposite of a debouncer. It is the edge-triggered flipflop, and the R-C time delay of the Reset signal prohibiting a trigger on the closely-spaced bounce transitions, that does the debouncing.