Up/Down Counter Not Counting Down

4 replies · 3K views · last reply
TheRedDevil18
Messages
406
Reaction score
2

Homework Statement


I'm trying to build a 2 bit counter using JK flip flops. In the simulation it counts up just fine, but when I switch it to count down, it starts at 3 and then goes to zero and counts up again.

Homework Equations

The Attempt at a Solution


[/B]
Here is my circuit diagram:
Circuit schematic of a 2-bit up/down counter with two 74HC112 JK flip-flops (U15:A and U2:A), AND and OR gates, a NOT gate (U6), switch SW1, and a 4511 BCD-to-seven-segment decoder driving a seven-segment display.


When the switch is closed it should count down, and when it's open, it should count up. The clock is connected to a 555 timer, just didnt show it.
 
TheRedDevil18 said:

Homework Statement


I'm trying to build a 2 bit counter using JK flip flops. In the simulation it counts up just fine, but when I switch it to count down, it starts at 3 and then goes to zero and counts up again.

Homework Equations

The Attempt at a Solution


[/B]
Here is my circuit diagram:
View attachment 105174

When the switch is closed it should count down, and when it's open, it should count up. The clock is connected to a 555 timer, just didnt show it.
I'll look more at this, but could you post your design equations?
 
berkeman said:
I'll look more at this, but could you post your design equations?

Y = M'Q + MQ'

Where Y is the output, those AND and OR gates.
M is the control input (switch), it counts down if M = 1 (closed switch) and up if M = 0 (open switch)

And the flip flop in the simulation is a 74HC112
 
Your circuit is using the JK flip flops as T flip flops. Look them up; T flip flops change state on every clock cycle.
 
If you want a synchronous machine, wouldn't you want the clock inputs connected only to the clock?