D-type flip-flops, with the inverted output connected to the D input, can toggle a clock signal. If your circuit has an extra Schmitt-trigger inverter gate, you can use it to accomplish the same thing. Every time you press and release the momentary pushbutton switch in Figure 1, the circuit reverses to the opposite of what it was before you pressed it.
|Figure 1.||A single Schmitt trigger provides a toggle function.|
You can use a Schmitt trigger because it has hysteresis that positions roughly symmetrically around half of the power-supply voltage, VCC/2. If a signal rises from 0 V to VCC/2, the input will be logic zero, so the inverter output is at logic one. If the signal drops from VCC to VCC/2, it will be at logic one, so the inverter output is at logic zero. At power-up, voltage at Point A rises from 0 V to VCC/2 because R1 = R2, and the inverter’s output will be high as VCC. Capacitor C charges to VCC/2. The momentary pushbutton switch in the circuit has NO (normally open) and NC (normally closed) states.
|Figure 2.||A waveform shows the signal plot in different points of the circuit.|
When you first press the button, capacitor C quickly charges to VCC because the inverter output is high. When you release the button, high logic voltage appears across the capacitor on the inverter input. Thus, its output goes low. The capacitor discharges through resistor R2 down to VCC/2. When you press the button for the second time, capacitor C quickly discharges from VCC/2 to 0 V because the inverter’s output is low. When you release the button again, the discharged capacitor shunts the inverter input, thus forcing its output high. The capacitor charges up through resistor R1 to VCC/2.Figure 2 shows the waveforms.
The circuit is insensitive to contact bounce. Because the 40106 contains six Schmitt-trigger inverters, one IC can support as many as six momentary switches. You can substitute a two-input NAND Schmitt trigger CD4093 for the 40106. If you need to change the output when you press the button, reverse the connection of the NO and the NC contacts of the switch.