1
\$\begingroup\$

I'm trying to build a toggle that turns a 4 bit counter on or off. Here's where I'm at so far:

Switch

As you can see, I'm using a single D flip flop. Ideally I want one switch to disable the chip, and another to re-enable it.

Im lost...

\$\endgroup\$
1
\$\begingroup\$

Use the clocked output from the switch as the clock to a control flop.

schematic

simulate this circuit – Schematic created using CircuitLab

A human pressing a button should be considered a separate clock domain. Therefore, two flops should be used to sync the input for CDC (Clock Domain Crossing). More about CDC here.

\$\endgroup\$
0
\$\begingroup\$

Since you have/want two independent inputs, you'll need to use a SR latch to store enable state. Since you're using an asynchronous latch, you won't need to debounce the buttons.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ This makes more sense... What's the triangle on bottom? \$\endgroup\$ – Amorphous Nov 27 '13 at 4:51
  • \$\begingroup\$ @Amorphous: That would be your ground connection. \$\endgroup\$ – Ignacio Vazquez-Abrams Nov 27 '13 at 4:58
  • \$\begingroup\$ Hmmm.... Why would you ground your buttons? \$\endgroup\$ – Amorphous Nov 27 '13 at 5:05
  • \$\begingroup\$ @Amorphous: 1) So that the inputs don't float. 2) So that you can detect the transition to V+ when they're pressed. \$\endgroup\$ – Ignacio Vazquez-Abrams Nov 27 '13 at 5:12
0
\$\begingroup\$

To use the D-FlipFlop as a toggle switch, you need to convert it to work as T-FlipFlop. To do the conversion, connect the Q~ (pin 6) to the D input (pin 2). Change the switch S2 from D to CP (pin 3). That should turn the counter on/off in the present configuration.

\$\endgroup\$
  • 1
    \$\begingroup\$ This doesn't work in practice. The switch contacts will "bounce" when pressed or released, giving you many edges on the clock and causing the FF to end up in a random state. \$\endgroup\$ – Joe Hass Nov 27 '13 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.