Remembering/latching a set of switches when a button is pressed - Page 1
Forum section: electronics / beginners

author: anfang
author_rank: Regular Contributor
timestamp: August 22, 2016, 02:22:19 pm
content: Hello EEVblog community!For my very first project I would like the ability to latch the state of a set of switches, so that, once set, I can change the switches without any effect on the circuit until I press the button again. How can I do this without a microcontroller?I am eager to learn, so full solutions are not needed (but welcome). What I am looking for are some pointers in the right direction or to the right terms or ICs.In practice I want to do this. I have 10 SPST or SPDT switches that control certain "settings" of a LED driver (different resistors get inserted in the circuit or get excluded). I do not want to see the effects of these settings until I press a momentary pushbutton. After that, I want to change the settings (flipping the switches) without disturbing the settings already in place. Once I press the button the new settings should replace the old ones.The initial memory state of early computers used to be set using a mechanism similar to this, but I could not find schematics around.Any help is appreciated!

author: alanb
author_rank: Frequent Contributor
timestamp: August 22, 2016, 02:47:04 pm
content: Google SR Flip Flops. This would be a starting point for your requirement. You can then find the components in 74 series or 4000 series logic gates.

author: Chalcogenide
author_rank: Regular Contributor
timestamp: August 22, 2016, 02:53:55 pm
content: A D (Data) type Flip Flop would be more suitable to latch the status of something.

author: SL4P
author_rank: Super Contributor
timestamp: August 22, 2016, 02:59:55 pm
content: There are also simple low cost multi-bit parallel loading LATCHes in the 74 type logic families.e.g. 74xx174

author: Zero999
author_rank: Super Contributor
timestamp: August 22, 2016, 03:03:29 pm
content: Yes, HEF/CD4013 or 74HC(T)74 has two D flip-flops.http://www.nxp.com/documents/data_sheet/74HC_HCT74.pdfhttps://www.fairchildsemi.com/datasheets/CD/CD4013BC.pdfThere's also the 74HC(T)174, which has six and a common clock. You want 10 and two of these ICs will give you 12 so you'll have a couple spare.http://www.nxp.com/documents/data_sheet/74HC_HCT174.pdf

author: anfang
author_rank: Regular Contributor
timestamp: August 22, 2016, 05:35:53 pm
content: Thank you all for the suggestions. A D flip-flop array IC where the CLK is connected to the switch is what I need. I also found the SN74HC273.Now the problem is how to "simulate" the open and close switches on the other side of the latches.A NPN resistor for each switch should work, but I have found only ICs with arrays of Darlington transistors (they are new to me). Aren't there arrays of normal PNP BJT or *FET transistors?

author: PA0PBZ
author_rank: Super Contributor
timestamp: August 22, 2016, 06:48:52 pm
content: What you want is called a latch, look at the 74LS374 for an example. If you want to switch resistors a NPN transistor is not the best choice, look at analog switches like the 4066 and his friends.

author: Zero999
author_rank: Super Contributor
timestamp: August 22, 2016, 08:34:25 pm
content: Yes but I wouldn't recommend LS parts for new designs, except under certain circumstances where the A/HC(T) won't cut it.The 74HC374 would be more suitable. It uses less power, the output saturates near the power supply rails and will work from 2V to 6V.The 74HC4016 is a better alternative to the CD4016. It has a lower on resistance. The only disadvantage is it's limited to a maximum supply voltage of 10V.http://www.nxp.com/documents/data_sheet/74HC_HCT4016_CNV.pdf

author: newbrain
author_rank: Super Contributor
timestamp: August 23, 2016, 07:05:52 am
content: Quote from: anfang on August 22, 2016, 05:35:53 pmOthers already suggested the 74HC373, perfectly suitable for your application.I'll go one step further and point to the 74HC573: about same price and oh-so-friendly pin out: inputs on one side, outputs on the other one!For simulating switches on the output side, it depends...Darlingtonsare fine, they are simply a couple of NPN or PNP transistor vith the collector in common and the emitter of th first connected to base of the second, to give a much higher gain. A typical example of Darlington arrays is the ULN2xxx series, very suitable for your purpose (ULN2803 has the right input resistors for 5V TTL or CMOS).If all that is needed is lighting some LEDs by switching in and out different valued resistors, you could even do away with just some some diodes, provided the maximum output current of the74HC573is not exceeded (35mA on a single output, but 70mA total absolute maximum rating).

author: Zero999
author_rank: Super Contributor
timestamp: August 23, 2016, 07:56:21 am
content: If you need SPDT switches then you need the 74HC4053.http://www.nxp.com/documents/data_sheet/74HC_HCT4053.pdf

author: anfang
author_rank: Regular Contributor
timestamp: August 23, 2016, 08:55:11 am
content: Quote from: PA0PBZ on August 22, 2016, 06:48:52 pmHow come NPN transistors are not the best choice to switch resistors?Do you mean that PNP-type transistors should be preferred to NPN-type resistors or are you referring to BJT vs FET?

author: PA0PBZ
author_rank: Super Contributor
timestamp: August 23, 2016, 09:31:44 am
content: Quote from: anfang on August 23, 2016, 08:55:11 amIt depends: if one of the legs of the resistor is at gnd level it is not a problem to use a transistor, but if it is a timing resistor where both legs are at some potential you can't simply use a transistor and you need an isolated switch. I have not seen your diagram and it is hard to guess what you are trying to do.I hope it makes sense now.

author: newbrain
author_rank: Super Contributor
timestamp: August 23, 2016, 09:32:17 am
content: Quote from: anfang on August 23, 2016, 08:55:11 amIt's not a PNP vs. NPN (at least at this power levels) or even BJT vs. MOS issue but rather a circuit topology question:if one end of the "switch" is referenced to ground (or Vcc) there's no problem at all with using NPNs/n-channel MOSFETs/ULN2803 (or PNP/p-channel MOSFETs in the Vcc case),if both ends od the "switch" are floating, you need something like a (74HC)4066 but be careful about the ON-state resistance and maximum current.If you have drawn a tentative schematic, feel free to post it for comments!

author: Zero999
author_rank: Super Contributor
timestamp: August 23, 2016, 10:19:24 am
content: BJTs are no good for switching analogue signals with a high impedance because the base current flows though the emitter or collector junction and interferes with the load/source.Discrete MOSFETs have a reverse body diode so are only any good if the signal is under 0.5V in the same direction as the diode. Two could be connected back-to-back but then the gate voltage would need to be the MOSFET's threshold above the maximum signal to turn on and below the minimum signal level to turn off. Four MOSFETs could be used (two NMOS back-to back and two PMOS back-to-back, in parallel) but the gates would need to be fed complementary signals.JFETs can be used as analogue switches but the gate voltage needs to be the transistor's cut-off below the signal level to turn it off and no more than 0.5V above the signal level when on, otherwise the gate junction will become forward biased an leak current into the system.The easiest way to implement an analogue switch is on an IC, which is why numerous parts exist. One limitation you should be aware of is that analogue switches are not solid state relays: there is no isolation and the analogue signal needs to be within the power supply rails.