DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: Buffalo Tom on March 04, 2020, 08:12:28 AM

Title: Radio button switching with 74C373
Post by: Buffalo Tom on March 04, 2020, 08:12:28 AM
Im trying to build a "Radio button" switch with 3 switches using 74C373 and 4049 as used in RG's "Programmable FX Switcher". At the moment Im only trying to lit leds on outputs Q1 and Q2 to see that everything works before moving to a relay driver. I have wired up switches to pins 3 and 5 on 4049 chip. And connected pin 2 and 4 from from 4049  to pin3 and 4 on 74C373 .. (only one switch shown on my drawing but I have two). Switching does not work and the leds on Q1 and Q2 outputs are lit all the time. Maybe I have misunderstood how to wire the chips. Can anyone see my mistake?

My version
(https://live.staticflickr.com/65535/49617828322_812d42cd42_o.png)

Original:
(http://geofex.com/Article_Folders/fxswitchr/fxselex7.gif)


Another thread from where I got the 100K resistor to ground on 74C373 pin 11.
https://www.diystompboxes.com/smfforum/index.php?topic=72865.0
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 04, 2020, 09:04:53 AM
My understanding is that the -LE going from high to low will copy the level on the D inputs to the corresponding Q output.
Quote.  When  LATCH ENABLE  goes low,  data at the  D  inputs,  which meets the set-up and hold time requirements,  will be retained at the outputs until LATCH ENABLE returns high again.
...as the data sheet puts it.
In other words, while -LE is low, the D inputs can change and the Q outputs remain at the value of the D inputs at the time -LE went high to low.
I'm not sure how RG's scheme is meant to work. Maybe he meant it for the 74C374 instead? That latches the D into the Q when the Latch Enable goes from low to high and the Q level will stay put until another latch command happens.
QuoteThe MM74C374 is an 8-bit, D-type, positive-edge triggered flip-flop. Data at the D inputs, meeting the set-up and hold time requirements, is transferred to the Q outputs on positive-going transitions of the CLOCK input.

You need the 100k after the diodes. If you see a diode feeding a logic input, you must expect to have a resistor to keep a valid logic level there when the diode isn't conducting. The resistor value isn't fussy -  too low is wasted current and too high is prone to noise pickup. 100k is a fair choice for 12v logic.

You might get it to work with the 373 if you put an inverter between the diode/resistor and the -LE pin?

Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 04, 2020, 10:15:56 AM
Quote from: anotherjim on March 04, 2020, 09:04:53 AM
My understanding is that the -LE going from high to low will copy the level on the D inputs to the corresponding Q output.
Quote.  When  LATCH ENABLE  goes low,  data at the  D  inputs,  which meets the set-up and hold time requirements,  will be retained at the outputs until LATCH ENABLE returns high again.
...as the data sheet puts it.
In other words, while -LE is low, the D inputs can change and the Q outputs remain at the value of the D inputs at the time -LE went high to low.
I'm not sure how RG's scheme is meant to work. Maybe he meant it for the 74C374 instead? That latches the D into the Q when the Latch Enable goes from low to high and the Q level will stay put until another latch command happens.
QuoteThe MM74C374 is an 8-bit, D-type, positive-edge triggered flip-flop. Data at the D inputs, meeting the set-up and hold time requirements, is transferred to the Q outputs on positive-going transitions of the CLOCK input.

You need the 100k after the diodes. If you see a diode feeding a logic input, you must expect to have a resistor to keep a valid logic level there when the diode isn't conducting. The resistor value isn't fussy -  too low is wasted current and too high is prone to noise pickup. 100k is a fair choice for 12v logic.

You might get it to work with the 373 if you put an inverter between the diode/resistor and the -LE pin?

Thanks for your reply. Just bought the 74C373 chips.. Thinking that was the one RG used. This schematic has been around för 20years and hopefully built by many forum members... Maybe someone can clarify if Im using the wrong chip. Hard to believe that RG schematic is "wrong"... Its more likely im doing something wrong  ;) Thanks
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 04, 2020, 10:18:31 AM
Datasheet: http://www.farnell.com/datasheets/59415.pdf?_ga=2.106808582.408011997.1583266595-1630263028.1583266595
Original article: http://geofex.com/Article_Folders/fxswitchr/fxswitchr.htm

(https://live.staticflickr.com/65535/49618010791_fc10003dcc_o.png)
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 04, 2020, 10:52:35 AM
The problem I see is that when -LE goes low to latch the D input state, the D input has also gone low -  so how can it make the Q output stay High and light a LED? It could be depending on the small timing delays in the circuit so that the latch sees the D as still being High at the micro-instant the latch action happens, but you shouldn't depend on that.

However, you should get high out of the Q output while the button press takes the D input High - but there's no guarantee that the Q output will latch high when you release the button. If it's not meant to latch the last button press, I'm not sure what it's for!
Have a look at the truth table for the 373. While LE is High, it's just an 8bit buffer. When LE goes low, Q is whatever it was before "preexisting output level". And what was that level? You can hope it's high, but the D input goes low at the same time as the latch (slightly sooner actually because the diode + resistor combo has a slower switching speed).

-you can try reducing the 100k pull down to 10k to speed the switching time up.



Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 04, 2020, 02:40:47 PM
Quote from: anotherjim on March 04, 2020, 10:52:35 AM
The problem I see is that when -LE goes low to latch the D input state, the D input has also gone low -  so how can it make the Q output stay High and light a LED? It could be depending on the small timing delays in the circuit so that the latch sees the D as still being High at the micro-instant the latch action happens, but you shouldn't depend on that.

However, you should get high out of the Q output while the button press takes the D input High - but there's no guarantee that the Q output will latch high when you release the button. If it's not meant to latch the last button press, I'm not sure what it's for!
Have a look at the truth table for the 373. While LE is High, it's just an 8bit buffer. When LE goes low, Q is whatever it was before "preexisting output level". And what was that level? You can hope it's high, but the D input goes low at the same time as the latch (slightly sooner actually because the diode + resistor combo has a slower switching speed).-you can try reducing the 100k pull down to 10k to speed the switching time up.

Thanks but I gave up on 74C373.. Found this schematic with CD4011B I will try instead.. Just need to buy the chip first  :)

(https://live.staticflickr.com/65535/49618342268_350ef42600_o.png)

Title: Re: Radio button switching with 74C373
Post by: Rob Strand on March 04, 2020, 05:36:31 PM
Quotehanks for your reply. Just bought the 74C373 chips.. Thinking that was the one RG used. This schematic has been around för 20years and hopefully built by many forum members... Maybe someone can clarify if Im using the wrong chip. Hard to believe that RG schematic is "wrong"... Its more likely im doing something wrong  ;) Thanks
It's possible your build has a bug but it could also be a temperamental circuit.   

Like Jim mentioned before the data needs to be valid when LE goes from high to low.   The 74C chip doesn't need to the data to be valid *after* LE goes low high but the 74HC and 74HCT do.   The problem is the LE *is* the data so if possible you want LE high to low transition to speed-up.   Jim's suggestion of reducing the resistor from LE ground should help.     

We can take that a little further by adding another diode and resistor.   What this does is add another diode drop so the LE goes low a little before the data input change.

Suppose you have,

  diode
  bank
  --->|---  10k to gnd --->   LE pin
  --->|

add another (single) diode and another 10k like this,

diode
  bank                    1x added diode                         
  --->|---  10k to gnd ------>|------ 10k to gnd--->  LE pin
  --->|

Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 05, 2020, 04:03:00 AM
It's moot anyway since the 74C parts are obsolete and the 4000 series equivalents are also hard to find, so it's perhaps not worth pursuing.
The 374 part would have the same timing problem, but then you would only have to add a small delay to the latch input to ensure it always goes low to high AFTER the D input goes low to high.

(https://live.staticflickr.com/65535/49618342268_350ef42600_o.png)
This appears to be a button latch with a power-on reset. A button press will give a constant high output from the gate UNTIL the power is removed. Is that what you want?
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 05, 2020, 02:07:44 PM
Quote from: anotherjim on March 05, 2020, 04:03:00 AM
This appears to be a button latch with a power-on reset. A button press will give a constant high output from the gate UNTIL the power is removed. Is that what you want?

I want that the output for the button pressed goes high and any other outputs go low. So I get the radio button style with only one button and relay activated at the time. Next stage is ULN2804 as relay driver. So here is where I am at the moment. Im using non latching relays. I have not tested this schematic yet. Still waiting for parts. I might remove the power-on reset transistor.

(https://live.staticflickr.com/65535/49623457247_eb78b40fa1_c.jpg)

ULN2804
(https://live.staticflickr.com/65535/49623588452_167c321cf6.jpg)

Data: https://www.mouser.se/datasheet/2/389/uln2801a-957494.pdf

Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 05, 2020, 04:10:04 PM
Yeh, sorry, I didn't consider what those diodes do.

Ok, let's look at that as it is.

On power-up, transistor M1 will be on until C1 is fully charged. That places a low into U1b which being a NAND gives a high into U1a. While SW1 is open, the other U1a input is also high via R3, so U1a output is low. Because it's low, the other input to U1b is low and the flip-flop formed is latched in this state as will all the others. All outputs are off which is a good start.
When M1 turns off, the lower flip-flop inputs go high via R2 but because the feedback from the upper gate is low, the state of the outputs don't change - another good thing.

Now press SW1. The input to U1a goes low and its output must go high. That output switches on.
U1b now has both inputs high so it puts a low back into U1a. When the switch is released, it won't change the flip-flop state so the output is now latched on. Another good!

When you operate any switch, the diode also pulls all of the lower inputs low so any latch that is already on will be toggled off.

So it all looks good I think!

There is a CD4044 available, which is x4 of those type flip-flops to reduce the parts count a bit.

Forgot to mention there is still a timing issue with this. When the reset diode acts, it also resets the flip-flop you want to set. Both inputs to the gates go low forcing both outputs high. When you release the button, the flip-flop will latch in some state with one output high and the other low - but which way? It depends on which input goes high first.
This is where those 1M resistors in the upper inputs come in to play. Together with the capacitance of the input pin, they form an RC time delay which makes the upper input the last to go high when you release the button. This gives just enough time for it to latch with the upper outputting a high. It's a dirty rotten trick - should really be a lower value resistor with a proper capacitor to ground to make the delay, but it should work.






Title: Re: Radio button switching with 74C373
Post by: Groovenut on March 06, 2020, 11:02:22 AM
You might also do a search for "randall aiken switching circuit"

The switching circuit he used in his amps will do exactly what you are looking for
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 07, 2020, 03:38:26 AM
Quote from: Groovenut on March 06, 2020, 11:02:22 AM
You might also do a search for "randall aiken switching circuit"
The switching circuit he used in his amps will do exactly what you are looking for

I found it.. A little bit harder to understand this schematic. 

(https://live.staticflickr.com/65535/49629056618_f579c4ce42_c.jpg)
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 07, 2020, 04:11:14 AM
Quote from: anotherjim on March 05, 2020, 04:10:04 PM
Forgot to mention there is still a timing issue with this. When the reset diode acts, it also resets the flip-flop you want to set. Both inputs to the gates go low forcing both outputs high. When you release the button, the flip-flop will latch in some state with one output high and the other low - but which way? It depends on which input goes high first.
This is where those 1M resistors in the upper inputs come in to play. Together with the capacitance of the input pin, they form an RC time delay which makes the upper input the last to go high when you release the button. This gives just enough time for it to latch with the upper outputting a high. It's a dirty rotten trick - should really be a lower value resistor with a proper capacitor to ground to make the delay, but it should work.

Thanks for your observation! Here is the original source.

INTRODUCTION --
The Radio Push-Button has an interesting function, occasionally needed, where pushing one momentary button of several gives a latched output representing that button, simultaneously cancelling the latched output from the previously pressed button.

The circuit draws only IC leakage current from the supply when quiescent so can be readily backed up with a coin-cell battery and a couple Schottky diodes if the button state needs to be preserved during power down (it should retain its state down to 3V or so).

OPERATION--
The circuit is shown below for three push-buttons but the circuit can be expanded indefinitely as needed, by adding additional stages.
Two NAND gates of the four in each CD4011 package are used in a cross-coupled latch configuration for each stage, to remember the last button pressed.
The total parts required for each added stage is 1/2 NAND gate package, two resistors, one diode, and one push-button.
You can reduce the IC parts count by one-half using the CD4044 quad NAND latch, which requires only 1/4 package per stage, in place of the NAND gates.

The simulation shows the operation for each of the buttons being pressed in various sequences.
As can be seen, the output for the button pressed goes high and any other outputs go low. (S1 through S3 with V1 through V3 are simulated push-button switches).

When a button is pushed. the corresponding Set input goes low, as well as all the RESet inputs through the diode (inputs are active low for a NAND gate latch).
When the button is released all inputs go high, but the Set input is delayed for a few microseconds due to the series 1 megohm resistor along with the input capacitance acting as an RC delay. This delay is sufficient to insure the corresponding latch output stays in the desired high state.

There is also a power-on reset transistor, M1, so that all outputs are zero at power up.
This could also be used as a master reset by momentarily pulling the transistor gate high.

(https://live.staticflickr.com/65535/49629069373_26999207d0_o.png)
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 07, 2020, 05:27:13 AM
Here is another one... Using CD4028. Looks almost too easy, will it work?

(https://live.staticflickr.com/65535/49629263688_67a4ba4327_o.gif)

Data: https://www.ti.com/lit/ds/symlink/cd4028b.pdf
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 07, 2020, 08:32:08 AM
The Randall circuit is very similar to the crossed NAND gates. There are 4 of them in the 4044 package. The 4081 AND gates reset other latches when a new button press happens and only that buttons latch is on. I can't see any obvious timing problems with that one. A possible problem with all combination logic is when more than one operation happens accidentally. In practice, if the switches are far enough apart, accidentally operating more than one should be unlikely.

The 4028 one is clever. It self-latches by feeding output back to input. When a second switch operates the BCD decoding clears the original Q output to one that isn't used so the latch drops out. The decoder then asserts and latches the correct Q for that last switch operation.
I wouldn't copy that 240R LED resistor though. With modern LED's and 12v you will get free laser eye treatment.
Note that if you accidentally operate 2 or more switches at the same time, all latches will drop out and the last switch contact to break will be the one that latches.

A big advantage of using a microcontroller for this is that it can be programmed to ignore multiple presses as invalid and only act after a single switch has been operated for some milliseconds to make sure it's intentional.


Title: Re: Radio button switching with 74C373
Post by: Rob Strand on March 07, 2020, 08:38:26 AM
QuoteHere is another one... Using CD4028. Looks almost too easy, will it work?
Looks nice and compact.   (If you care, you might be able to press some combination of buttons and get no relays latching you would have check all the combinations.)

Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 07, 2020, 10:42:28 AM
Will try the CD4028 version first. Amazing if it works the way I want with just 1 chip and 3 resistors. Can I leave pins 3,4,5,6,7,9,11,15 unconnected?

(https://live.staticflickr.com/65535/49630084603_bbe30ce5a2_o.png)

(https://live.staticflickr.com/65535/49630170358_ea1e9ecac2_o.png)
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 07, 2020, 11:22:56 AM
Unused outputs can always be left unconnected. All the inputs have a connection to something so they are ok too.
ULN2004 transistor arrays already include a suitable base drive resistor so you could do without R5 to R8.
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 07, 2020, 11:39:46 AM
Quote from: anotherjim on March 07, 2020, 11:22:56 AM
Unused outputs can always be left unconnected. All the inputs have a connection to something so they are ok too.
ULN2004 transistor arrays already include a suitable base drive resistor so you could do without R5 to R8.

That's great. Thanks Jim
Title: Re: Radio button switching with 74C373
Post by: Groovenut on March 07, 2020, 06:25:48 PM
Quote from: anotherjim on March 07, 2020, 11:22:56 AM
Unused outputs can always be left unconnected. All the inputs have a connection to something so they are ok too.
ULN2004 transistor arrays already include a suitable base drive resistor so you could do without R5 to R8.
Isnt pin 11 an input?
Title: Re: Radio button switching with 74C373
Post by: Slowpoke101 on March 07, 2020, 06:55:06 PM
Quote from: Groovenut on March 07, 2020, 06:25:48 PM
Quote from: anotherjim on March 07, 2020, 11:22:56 AM
Unused outputs can always be left unconnected. All the inputs have a connection to something so they are ok too.
ULN2004 transistor arrays already include a suitable base drive resistor so you could do without R5 to R8.
Isnt pin 11 an input?

Pin 11 is definitely  an input. In this particular example it should go to 0V (ground ).
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 08, 2020, 04:15:41 AM
Ah, I was looking at the 4 channel example. Yes pin11 to ground.
Title: Re: Radio button switching with 74C373
Post by: R.G. on March 08, 2020, 11:37:18 AM
To lessen the mystery of the 74C373 a bit, yes, it works. However, the 74373 has a timing quirk that makes it particularly suited to this application.
The underlying idea in a non-chip-specific way is to have several D latches, each with an input. All the "capture data" lines are tied in parallel to the OR of the inputs so that any one input changing works the capture data lines. So any input being set latches all of the inputs, only one of which is active.
However, with fast logic, nanoseconds matter. Most logic D latches have a set up time which is a requirement that the data be valid some number of nanoseconds before the activation of the capture signal. This ensures time enough for the input signals to be ready before the capture signal tells the latches to set to the new condition. They also have a hold time, the number of nanoseconds after the capture line goes inactive that the data must remain steady so the data will be properly latched in and steady.
This application tries to use the data inputs for both data and capture. It tinkers with ORing the datas to make the capture signal, which more or less automatically satisfies the set up time. But the data line causing the capture signal drops before the capture line can drop. So in the raw condition, the data to the latches drops before the capture line goes inactive.
The 74C373 is somewhat unique in that it has a negative data hold time. The insides of the chip naturally allow data to go invalid some number of nanoseconds before the capture line goes inactive. This makes it a natural in this application, excepting for that being obsolete and unavailable thing.  :icon_biggrin:

It is possible to fake things to use other chips. You can buffer the inputs and use diode-resistor-capacitor networks to hold data up longer and make the capture line timing better for stock logic chips. It's a bit of a pain, but I have done it when I needed a 74C373 and didn't have one. Similar tricks work to make SR NAND and NOR latches work, in various combinations, and of course you can build anything needing latches out of JK flops. I personally find bare-latches flipflops distasteful - it's a personal limitation, I suppose. I just don't like them.

But this is the 21st century. A $0.50 controller will do eight inputs as a parallel latch of eight pins, or one of N, or momentary on each of N, or latching N and selectable momentary on any of the N ( this is the Mark Hammer configuration  :) )   I do realize that every time I say "microcontroller" peoples' eyes glaze and they start looking for an exit, but really - the reason that 74C373 and its ilk are hard to find is that uCs are so very good and so very cheap.

If anyone wants to look  at it, I think I can still find my code for running a one-of-N latch setup for PICs. It uses one of the cleverest tricks I've ever seen for processing many inputs at the same time: vertical-adder logic. I found this in a post by Scott Dattalo on the PICList forum, at least fifteen years ago. Once you see the trick, you slap your forehead. It's that good.
But the code, written in BASIC, reads N bits from a port every 10ms or so, clocking this into a software shift register of a few bytes' length. With the few-reads history of reading inputs every so often, you can do logic on the most current and preceding-few reads. Doing byte-wide logic operations on several reads lets you produce results for each bit position separately, but all of them at the same time. Eight inputs can be set up so that you get latch and debounce on eight inputs, each input ignoring all the rest. I used this for my first footswitch array setup. You can do logic across the results as well - I used this to do a one-of-N radio button. And you can mask the byte-wide results so that some inputs do one function, others do another function. As you might imagine, I went vertical-adder mad for a while.  :icon_lol:

If you are at all technically inclined, go give a look at microcontrollers. Programmers are cheap, relatively, and so are the chips. I used to use PIC BASIC Pro, but lately I've converted over to Great Cow Basic, which is free for the download.
Title: Re: Radio button switching with 74C373
Post by: R.G. on March 08, 2020, 02:13:36 PM
I got sucked in by looking at this and pondering through my archives. There are two reasons to use the 74C373. One is that its data hold time to de-asserting LE is negative; the data can go invalid a few microseconds before LE goes invalid. I vaguely remembered some work on making the 374 version work by deliberatelyl extending the LE signal with diode/r/c nets. Haven't found that one yet. But the biggie was that the 74C family works directly on 9Vdc, unlike most new logic. There are newer 40xx3 octal transparent latches like the 74C373 that work up to 12-15V, but the ones I found don't have the negative hold time from D to de-asserting LE. The Toshiba variant has a zero hold time, but that's not quite good enough.

You can make this work without MML by using an 8-input gate on the signals to make the LE signal and putting an RC hold on that to extend it a little.

But all the 8-input D latches seem to cost as much or more than a uC to do the job, even the ones which need 5V or less for a power supply. I found you can use two **174 style latches and save some money - $0.72 for two of them versus $1.40 for an 8-bit D. The processor I'd use today is the PIC16F15344, which Mouser sells for $1.21 in ones. It works on 2.4V to 5.5V,  and uses nanowatts, so it would run on either a zener or a string of diodes for a regulator. Getting to 9V levels would most easily be done by the ULN2x0x series mentioned already. One of the ULN2803/4 would do eight relay driver outputs, and include the catch diodes, as mentioned.

Using the PIC does all the fancy steps and debouncing as well. This gets up to about $3.00 in parts, but is much less fiddly than any currently available CMOS. Out of curiousity, what does a real 74C373 cost these days?
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 08, 2020, 07:34:03 PM
Thanks R.G. I bought 20x 74C373 and paid $33,80 USD. After reading your post I really wanna give 74C373 a chance again. But Im not sure I understand the original schematic. Is this correct?   

(https://live.staticflickr.com/65535/49636504158_59672dbe1a_o.png)
Title: Re: Radio button switching with 74C373
Post by: Sooner Boomer on March 08, 2020, 08:51:29 PM
How do these circuits handle switch bounce?
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 09, 2020, 05:47:56 PM
Latching circuits can be immune from contact bounce. Once the logic level is latched, it takes a deliberate opposite action to un-latch it. A repeated action due to bouncing is only giving the same command to the latch circuit, not an opposite one. This is especially true with the S-R flip-flop since Set and Reset are separate inputs.
Title: Re: Radio button switching with 74C373
Post by: Slowpoke101 on March 10, 2020, 02:14:58 AM
Quote from: Buffalo Tom on March 08, 2020, 07:34:03 PM
Thanks R.G. I bought 20x 74C373 and paid $33,80 USD. After reading your post I really wanna give 74C373 a chance again. But Im not sure I understand the original schematic. Is this correct?   

(https://live.staticflickr.com/65535/49636504158_59672dbe1a_o.png)

A couple of revisions - I think they are correct but I have been wrong before. Good luck and let us know how you go.


(https://i.postimg.cc/grVs2yCW/Revised-Switcher1.jpg) (https://postimg.cc/grVs2yCW)
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 10, 2020, 07:08:26 AM
YES! Thank you very much. I had the diode network on the inputs wrong. On the original R.G. drawing all lines is crossing each other and it's hard to know which lines to be connected or not. Another thing was to add a 200K resistor from LE to ground. Without that resistor the selected led don't stay on.

So the basic radio switch function works now! There is just one bad thing.. On power up all leds are on. I want the switcher to start up with just Q1 active. So need a solution for that. More diodes?

(https://live.staticflickr.com/65535/49643594677_a43fb5b477_o.png)
Title: Re: Radio button switching with 74C373
Post by: merlinb on March 10, 2020, 07:17:13 AM
https://www.diystompboxes.com/smfforum/index.php?topic=102786.msg1151280#msg1151280
(https://i.postimg.cc/NfQJpQGz/Footsw-itch-Controller3.png)
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 10, 2020, 08:54:46 AM
Really liking Merlins suggestion. It solves a power-0n situation where none of the channels will be selected. That diode from Q0 bootstraps the channel A latch on for you.

I've been puzzling how that 74C373 can latch valid data in a "shut the stable door after the horse has bolted" scenario.
The equivalent circuit shows it isolates each D input by a "T" Transmission gate ( like a 4016 type of switch) which is then buffered and latched by positive feedback via another T gate. That means the D level can hang around internally at a high enough voltage to be a logic high although it started to go low when the -LE input did. The feedback latch will boost it up to full high logic level.
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 10, 2020, 10:29:42 AM
Quote from: merlinb on March 10, 2020, 07:17:13 AM
https://www.diystompboxes.com/smfforum/index.php?topic=102786.msg1151280#msg1151280
(https://i.postimg.cc/NfQJpQGz/Footsw-itch-Controller3.png)

Thanks. Have you built this one and it works for you? Im having some trouble.. Leds looses power after 20 seconds and dies.. After that buttons don't latch. Everything is very unstable. If I unplug the power and start over everything works again but only for some time then it's the same type of problems again. Its on a breadboard so maybe I have bad connections somewhere but I don't think that's the problem.  :-[
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 10, 2020, 11:42:49 AM
Am I missing any parts that's needed to make this stable?

(https://live.staticflickr.com/65535/49644206682_d858a174cb_o.png)
Title: Re: Radio button switching with 74C373
Post by: anotherjim on March 10, 2020, 11:47:35 AM
Where have you go the LED's connected?
Title: Re: Radio button switching with 74C373
Post by: merlinb on March 10, 2020, 11:52:16 AM
Quote from: Buffalo Tom on March 10, 2020, 10:29:42 AM
Im having some trouble.. Leds looses power after 20 seconds and dies..
Maybe you're using resistors that are too small in value? The chip can only supply a little current. Use 4.7k resistors or more.
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 10, 2020, 11:57:48 AM
Led 1 on [OUT 1] pin 10
Led 2 on [OUT 2] pin 13
Led 3 on [OUT 3] pin 12

Im running it on 12V and 3.9K resistors for the leds.
Title: Re: Radio button switching with 74C373
Post by: merlinb on March 10, 2020, 12:03:27 PM
Hmm, I'm not sure of the chip's max current ability, but it may be more prudent to use 10k resistors or more.
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 10, 2020, 12:58:19 PM
Quote from: merlinb on March 10, 2020, 12:03:27 PM
Hmm, I'm not sure of the chip's max current ability, but it may be more prudent to use 10k resistors or more.

Yes hopefully current related.. Hope so. I don't need to put the leds direct on the CD4028 chip. That was just for testing the switching logic to see whats going on. I will try tomorrow with a ULN2804 transistor array and drive the leds (and relays) from there..

Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 10, 2020, 01:28:08 PM
Quote from: merlinb on March 10, 2020, 12:03:27 PM
Hmm, I'm not sure of the chip's max current ability, but it may be more prudent to use 10k resistors or more.

(https://live.staticflickr.com/65535/49644614456_dd3fd3267e_o.png)

(https://live.staticflickr.com/65535/49644875787_1df13872f8_o.png)
Title: Re: Radio button switching with 74C373
Post by: Buffalo Tom on March 11, 2020, 05:00:41 AM
CD4028 version merlinb posted works great together with ULN2804. I have no problems with the circuit once the ULN2804 is connected. So for a 3 button switch I believe that's the best one of all different versions we talked about here.

I also continued with the 74C373 version and that one is running fine too if you want more than 3 buttons. I implanted the reset function from the randall aiken switching circuit so its starting up with Q1 active.

Thanks everyone that helped me

(https://live.staticflickr.com/65535/49647013121_4d2285ea91_o.png)


Title: Re: Radio button switching with 74C373
Post by: potul on March 11, 2020, 09:50:27 AM
I agree with R.G, nowadays with the prices of uC and the ease of access to both programming devices and software development tools, I would go for a PIC or AVR based solution

For a similar price you can get something like an ATTINY84, or if you need more I/O an Atmega328 for a little more (less than 2$). And your parts count will decrease, as you can run them with internal oscillators, and you can do all the debouncing by software as well. And if you use latching relays, there are options that don't even require a relay driver.

For all my switching needs I abandoned long ago the use of logic ICs. I first moved to PICs, but now I use mostly AVRs that can be programmed in C with Arduino IDE and have tons of libraries available.
Title: Re: Radio button switching with 74C373
Post by: Ben N on March 11, 2020, 10:56:52 AM
AND if you do it with a uC, MIDI control becomes trivial, with no extra hardware except an optocoupler for thru/out.