Too long out of electronics

Thread Starter

In2

Joined Dec 13, 2011
5
Hi
I have been 'out' of electronics for 20 years or so but have got sucked back working on a project for a controller for a simulator on a PC.

I just cannot seem to get my head around this one

I have two momentary switches they need to latch and send a high(s) to a switch going back to a PC each press of the switches toggles the switches to the PC on and off and lighting an led to show the on/of state
ok I can do that no prob with a 7474. Here's the tricky bit (for me anyway).

I need to have each momentary capable of toggling on and off independently as well as canceling the other latch only if it is on.

ie. only one switch allowed on at a time or no switches on at all

I really don't want to use the likes of a pic etc apart from not knowing how to program I have not got any!!!

Hope that makes sense


For the curious the pc switching is taken care of via a dedicated (commercial) board but it works the same as pressing a keyboard button (as far as the pc is concerned)

Thanks for any input on this.
 

crutschow

Joined Mar 14, 2008
34,428
If I understand correctly this should do what you want:

Use two 7474s or equivalent.

Each 7474 is triggered on or off by its clock input from its respective momentary PB switch. The D input is connected to the /Q output for this.

Each PB output also goes to the Reset input of the other FF.

You, of course, need to have a debounce circuit at each PB output to prevent multiple triggering of the FFs.
 

SgtWookie

Joined Jul 17, 2007
22,230
Each PB output also goes to the Reset input of the other FF.
I'm afraid that this will effectively disable the other FF if the CLR\ is held low. It needs to be a momentary pulse.

I drew up a couple versions that should work, using 7473 and 7474 ff's. The initial state on power-up will be undefined, but an input from either switch will sort that out:

 

Attachments

crutschow

Joined Mar 14, 2008
34,428
I'm afraid that this will effectively disable the other FF if the CLR\ is held low. It needs to be a momentary pulse.

I drew up a couple versions that should work, using 7473 and 7474 ff's. The initial state on power-up will be undefined, but an input from either switch will sort that out:
You are correct. I forgot that 7474s have active low for clear. My scheme should work for FFs with active high reset such as the CD4013.
 

Thread Starter

In2

Joined Dec 13, 2011
5
just an initial quick "thanks guys"
I will look into these when I finish work later today.......
 

SgtWookie

Joined Jul 17, 2007
22,230
My scheme should work for FFs with active high reset such as the CD4013.
I'm sorry, but it wouldn't work with a 4013 either; as when an/the input(s) are held high, the clock and data inputs are ignored.

The 4013 would require a brief high pulse for this application, where the 74 series FF's require a brief low pulse.

Truth table excerpt from a Philips/NXP HEF4013B attached.
 

Attachments

praondevou

Joined Jul 9, 2011
2,942
I'm not sure if it's harmful to this particular IC or IC series, but when the /Q output from one FF goes from LOW to HIGH the RESET input of the other FF will be raised to higher than VCC for a brief moment.
To avoid this you could possibly add a diode from each RESET input to VCC (cathode at VCC).
 

SgtWookie

Joined Jul 17, 2007
22,230
That's a good point, praondevou. I did have 1N914 diodes in there before, but I decided to let the built-in ESD diodes take care of the overvoltage. Perhaps not the best tactic, but I was trying to keep the circuit reasonably simple so that it was more easily understood.

For example, in the left schematic, diodes would go across R1 and R2 with the cathodes towards Vcc.

In the right schematic, diodes would go across R3 and R4 with the cathodes towards Vcc.
 

crutschow

Joined Mar 14, 2008
34,428
I'm sorry, but it wouldn't work with a 4013 either; as when an/the input(s) are held high, the clock and data inputs are ignored.

The 4013 would require a brief high pulse for this application, where the 74 series FF's require a brief low pulse.
He stated the switches are momentary so I assume the Reset will only be high only while the button is pushed. Am I missing something?:confused:
 

SgtWookie

Joined Jul 17, 2007
22,230
He stated the switches are momentary so I assume the Reset will only be high only while the button is pushed. Am I missing something?:confused:
That's a good point, which leads to another question - we don't know what kind of actuator that In2 is speaking of, nor why a momentary input would need to be latched.

I can't think of an aircraft control input that would need latching offhand.
A gear up/down or tailhook up/down would be a simple two position switch, either SPST or SPDT.
A joystick actuator would have four independent momentary switches, or possibly two SPDT CO switches if one were a glutton for punishment.
Trim adjustments would be momentary.

Weapons control input is a different matter. If a fighter such as an F/A-18 were being simulated, then at least a 3-way control would be required; radar (fox1; eg AMRAAM)/heat (fox2; eg Sidewinder)/guns (eg Vulcan 20mm).

But even then, the reset/clear/unset/whatever input to the opposite flip-flop needs to be momentary, as no matter the switch input, if the reset/clear/unset/whatever input is held in a state where it is active, then the FF will ignore the clock input; thereby disabling it.
 

crutschow

Joined Mar 14, 2008
34,428
I'm still confused. Where does the OP mention aircraft controls? He did mention a simulator but not the type.

He stated that he wanted the opposite FF to be reset so I wouldn't think that FF would need to respond to its switch until the other switch is released. Perhaps I misunderstood his requirements.
 

SgtWookie

Joined Jul 17, 2007
22,230
That's also true; we don't know what they are actually simulating.

After thinking about it some more, it could be done with the 4013 like this:



I misread your solution; I was thinking you meant resetting the opposite f/f by using the Q\ or Q output instead of the switch. Sorry about that.
 

Attachments

davebee

Joined Oct 22, 2008
540
I don't think anyone's mentioned this yet, but the logic you're stating sounds like what an exclusive-or gate provides.

The XOR output is high if either but not both inputs are high, so if your buttons were first combined using an XOR gate, and its output toggled the flipflop, would that do what you want?
 

Thread Starter

In2

Joined Dec 13, 2011
5
Hi guys
Interesting reading and thanks for the input really educating!....

Ok I did try to keep it brief to make it readable and stop you all nodding off..here is the long version !

It is in fact for a flight simulator and as Sgtwookie rightly says all the controls, as far as the pc is concerned, are in fact momentary (as all the functions can be operated from the keyboard).
My need for the latching is so I can display on my own panel the same information as the program panel ie. status lights etc.

I appreciate the momentary switches can operate the the simulator directly with the interface I am using but this would be without my panel showing correct info.

I know I can use micro pro's to read the information from the program back to the panel and also to control it all but I will probably be dead and buried before gaining the required knowledge. I can buy such a panel in excess of £400 and is over the top and over my budget!

The project has grown (as most of my projects do) from simple switches.

Back to the point
To act as a switch across the interface I will be using 4016 quad bi lateral switches..I could have the momentary do this directly but I wish to isolate the pc end from the logic and switching board and I have other uses on the circuit for the remaining bi lats.

The whole problem for this area of the panel ( the next section has 3 such latches ) is as follows:-
Two momentary switches each to cancel the other. These switches will only actuate if the "master" switch (spdt) is on. Whenever the master switch is turned off then BOTH toggles will be off (reset to off).

The master switch part of the circuit I am handling with bi lats to allow/prevent/reset the flip flops..BTW I am using 7474 in preference cos I got loads of them !

In further response to SgtWookie (thanks again for the circuit) I was kinda hoping to use the not Q's for the LEDs but no probs can get around that easy enough.

I hope this helps ?
in2
 

Neil Groves

Joined Sep 14, 2011
125
Hey Sgt Wookie, what do you use to draw your circuits? i am looking to draw my stuff as neat as this instead of using a pen and white out.

Neil.
 

SgtWookie

Joined Jul 17, 2007
22,230
My need for the latching is so I can display on my own panel the same information as the program panel ie. status lights etc.
I see; that makes sense.
I was thinking in terms of flight controls; not keyboard inputs.

I know I can use micro pro's to read the information from the program back to the panel and also to control it all but I will probably be dead and buried before gaining the required knowledge.
Actually, it is not nearly as bad as you're thinking; and with a project like this where many inputs and outputs are involved, microcontrollers will eliminate a LOT of components, which means that your circuit board(s) will be far smaller, require less time for design/assembly, and if you need changes in function later, the uC can simply be re-programmed instead of having to chop up the board or start over completely.

I can buy such a panel in excess of £400 and is over the top and over my budget!
You might be surprised at how much large circuit boards will cost you, not to mention all of the components you will need to stuff them with.

The project has grown (as most of my projects do) from simple switches.
That seems to happen to most projects. ;)

Back to the point
To act as a switch across the interface I will be using 4016 quad bi lateral switches.
CD4066B's have the same functionality of the CD4016B's, but they have a much lower impedance; ~150 Ohms vs ~280 Ohms. You are likely going to have problems trying to control 74 series logic ICs using 4000 series ICs.
I could have the momentary do this directly but I wish to isolate the pc end from the logic and switching board and I have other uses on the circuit for the remaining bi lats.
4066/4016 quad bilaterals won't isolate the PC from the logic. You would need to use optocouplers/optoisolators, digital isolators, or other optical or magnetic coupling devices to achieve actual isolation.

The whole problem for this area of the panel ( the next section has 3 such latches ) is as follows:-
Two momentary switches each to cancel the other. These switches will only actuate if the "master" switch (spdt) is on. Whenever the master switch is turned off then BOTH toggles will be off (reset to off).
OK, then you will need a 3rd input to any of these latches that will hold them all in a reset condition, regardless of any other input.

The master switch part of the circuit I am handling with bi lats to allow/prevent/reset the flip flops.
As I mentioned before, you're going to have difficulties trying to drive 74 series logic using outputs from 4016 bi-lats.

BTW I am using 7474 in preference cos I got loads of them!
Just because you have lots of something, does not mean that it is the best choice for a project. I think I've already shown that a 7474 will be parts-intensive; you will need a minimum of 4 resistors, 2 caps and 2 diodes for the basic F/F circuit - but the master reset function poses additional problems and additional component requirements. Also, each IC will require an 0.1uF bypass cap across the Vcc/GND pins; this is a minimum requirement for any IC.

In further response to SgtWookie (thanks again for the circuit) I was kinda hoping to use the not Q's for the LEDs but no probs can get around that easy enough.
You'll need to use a driver transistor or MOSFET for the LEDs, as otherwise the LED load might prevent the output from rising high enough. 74 series logic ICs have very anemic current sourcing abilities. 74HC are better at it.

The basic 74 series are power hogs compared to 74C/74HC IC's.
4000 series ICs are very low power.
Both the 74xx series and 4000 series are quite old and basically obsolete; they are no longer affordable for use in commercial products, as far too much board space is required. A single FPGA or uC can replace literally hundreds of them.

If you have not begun documenting all of your latching LED's required yet, it's time to start. What is each input, and how many of them, what are the outputs and how many of them? How do they need to interact, if ther is interaction - such as the master switch resetting everything?

You need to have all of this info put together so it can all be viewed at once.

There are other considerations as well - simple things like the intensity of the LEDs on your panel could be a "gotcha" if you have not planned for it.
 

SgtWookie

Joined Jul 17, 2007
22,230
Hey Sgt Wookie, what do you use to draw your circuits? i am looking to draw my stuff as neat as this instead of using a pen and white out.
Most of my simulating I do using LTSpice; those schematics are easily recognized not just due to the style, but because I use a light yellow background for them.

For these schematics, I used a program called Circuitmaker Student. It is an obsolete program; has not been supported by the company in over 10 years, you cannot add new parts to the library, and the Student version is limited to 50 components per schematic. However, it still has some useful features, and is handy for "quick and dirty" schematics like I posted in this thread.

Cadsoft Eagle is another program I use; primarily for schematics that I will be creating board artwork for. Eagle does not have built-in SPICE simulation of circuits. There is an available SPICE add-on by Beige Bag Software for around $200, but I don't have that add-on.

I have others, but those are the main three that I use.
 

Thread Starter

In2

Joined Dec 13, 2011
5
SgtWookie.
Again thank you for your time and trouble I am most grateful.


Actually, it is not nearly as bad as you're thinking;
People that can do things ALWAYS say that LOL.
I did try for a long time, a while back, learning to use pics but it just will not stay in my head (maybe my heads full?:))
You might be surprised at how much large circuit boards will cost you, not to mention all of the components you will need to stuff them with.
The whole project is going to come in at around £130 that figure includes the price of the components I already have and the plexiglas panels etc The micro route would also mean extra interface boards plus the programs to interface it. One day maybe!

There are in all 14 push led illuminated momentary switches, 5 home brew rotary switches.3 toggles.(and a partridge in a pear tree )

The main panel is built in modules and the ordinary on off functions work a treat with the 74hc74 and 4016's.

I have a lot of components to hand (as I do pcb boards) and the fact of having them do make them more attractive.
Ok if it was just one or two then yes the few pence for the better chip is worth it ...

I am in fact using 74HC74's just too lazy to type it all and I was really only interested in the function of the logic than the peripheral stuff debounce/power supply/decoupling/et al.

4066/4016 quad bilaterals won't isolate the PC from the logic. You would need to use optocouplers/optoisolators, digital isolators, or other optical or magnetic coupling devices to achieve actual isolation.
I wasn't thinking so mush of complete electrical isolation more just a simple way for switching an 'off board' common and input pair.

There are other considerations as well - simple things like the intensity of the LEDs on your panel could be a "gotcha" if you have not planned for it.
Yes thanks for the heads up on that one Very good point the actual back lighting LEDs for the panel will be on a variable. The LEDs on the switches do not have to be bright so I have that covered with resistor arrays. My real challenge (if I decide to go that far ) will be to make the 23 x 7 seg displays dim-able. A challenge because the power requirement will alter with differing sets of numbers (how to keep them all the same intensity?).....might leave that out eh? :rolleyes:

I have both flow diags and schematics (of a sort....nowhere as neat as yours but I know what they mean:D)
 

Neil Groves

Joined Sep 14, 2011
125
Thanks Sgt Wookie, i downloaded the free version of circuitmaker student, it isn't fully functional as it's the free version but it's enough to let me draw circuits really neatly and it's bags of fun to use.

thanks again.

Neil.
 
Top