1
\$\begingroup\$

I'm trying to simulate a binary counter that is supposed to be activated by a button B, then count until 40, reset and stop until B gets pushed again. If B is pushed while the counter is working it resets and starts over.

I'm supposed to build this with simple stuff like flip flops. I already have an 8 bit counter available with a clock and Reset input entries.

I know how to read 40 off the counter (2^5+2^3, or when outputs 5 and 3 are true).

I think I need a variable B, for the button, a variable T, which is $$\lnot (C_5.C_3)$$ (C is the counter's outputs, so T will be true while the counter's output isn't 40), and R which is the value of reset. I tried to draw the state diagram: enter image description here

I'm not sure which are flip flops and which are variables here or even if this is entirely correct. I think I am supposed to use a flip flop for R but I don't really know how to go about it.

\$\endgroup\$
1
  • \$\begingroup\$ A way of many: 1. Find how to cause JK flipflops to toggle. 2. Arrange 5 flip flops so 1st clocks 2nd, 2nd clocks 3rd etc. You now have a 5 stage counter. 3. Find out what AND (or NAND) gates do. 4. Arrange an AND gate to combine FF outputs as required to make a I_AM_AT_40 signal - use this to stop the clocking. 5. Work out how to reset all flipflops and unstop the clocking. 6. Ask if unclear. \$\endgroup\$
    – Russell McMahon
    Dec 30 '19 at 7:34
1
\$\begingroup\$

A way of many.
Aim: give you a lead without doing your work for you:

You need a clock source. This may be provided or you MAY have to provide / generate it.

  1. Find how to cause JK flipflops to toggle.

  2. Arrange 5 toggling flip flops so 1st clocks 2nd, 2nd clocks 3rd etc.

You now have a 5 stage counter.

  1. Find out what AND (or NAND) gates do.

  2. Arrange an AND gate to combine FF outputs as required to make an I_AM_AT_40 signal - use this to stop the clocking.

  3. Work out how to reset all flipflops and unstop the clocking.

  4. Ask if unclear.

\$\endgroup\$
7
  • \$\begingroup\$ The counter is already available so I only need to work from 4. I can do 4. What I am having trouble with is 5 because of the button. If there was no button all I'd have to do is use an AND gate and connect it to reset so it would reset when the counter reached 40. I can do that. The problem is the button. \$\endgroup\$ Dec 30 '19 at 7:48
  • \$\begingroup\$ @SilenceOnTheWire you could always use an OR gate too. Connect the output of the AND gate, plus the button to the OR gate. That way, if it reaches 40 or the button is pushed, it will reset \$\endgroup\$
    – MCG
    Dec 30 '19 at 8:48
  • \$\begingroup\$ @MCG But if it resets without the button being pushed it will start counting again. I want it to "freeze" at zero until the button is pushed again. \$\endgroup\$ Dec 30 '19 at 9:05
  • \$\begingroup\$ @SilenceOnTheWireOh I see! Apologies, I didn't get that bit. You can always latch the output of the OR gate, and use the start button to 'un-latch' it \$\endgroup\$
    – MCG
    Dec 30 '19 at 9:07
  • \$\begingroup\$ You say "Reset and stop". That's two actions BUT they can have the one trigger. Yes? | You have flip flops which you can toggle with a clock pulse (1.). A flip flop can store a "state". In this case you want a state "stopped". You have an enabling signal from the 3-5 AND. You can toggle a stopped flip flop which in turn .... . | And you have a reset button which can reset the whole counter AND the state flip flop. Yes? || Warning - if you rely on a button to provide a reset pulse ENSURE it provides a signal that is there long enough AND ... \$\endgroup\$
    – Russell McMahon
    Dec 30 '19 at 9:13

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.