# synchronous 4-bit BCD up/down counter using D-flip flops

Discussion in 'Homework Help' started by syedamehakfatima, May 2, 2012.

1. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
sir i am making 4 bit BCD counter using D-flip flops for this i need just equations when x=1 and when x=0.. plz tell me is this rite or wrong???.... plz............
my sequnce is tha (D3), (D2) ,(D1), (D0) and flipflop inputs are shown as D4,D3,D2,D1. And outputs are D,C,B,A.
x=0,
D4=A'D+ABC
D3=B'C+A'C+ABC'
D2=A'B+AB'C'
D1=A'

x=1,
D4=B'C'D'
D3=B'C+C'B
D2=B
D1=A'

plz rpl me fast i have to submitt it tomorrow plz

2. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
Pretty risky asking for help on an informal forum the day before it's due. Perhaps next time you might want to get ahead of the game a bit more.

You talk about (D3) ... (D0) and then talk about D4 ... D1. What is what?

What does x=0 mean? What does x=1 mean? Are we expected to guess, or read minds?

What steps have you done to check whether the results are correct? If you build up the next state tables from the equations you have, what do you find?

Before you do that, you might just look over the equations and see if they make sense based on some simple sanity check.

In both cases of x, you have that D1 is always set equal to A', meaning that it simply toggles regardless of the state of the other bits and regardless of whether you are going up or down. Is that the behavior expected?

In the case of x=1, you have that D2 is always equal to B, meaning that it stays the same, regardless of the state of the other bits. Is that the behavior expected?

When DCBA = 0101 and x=0, what is the next state supposed to be? What will it be?

3. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
i dnt understand what u want to say?? what u want to know?

4. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
First, try writing in full sentences, this isn't a text message.

I'll try to be more explicit:

1) Your post says, "my sequnce is tha (D3), (D2) ,(D1), (D0)". I'm having to infer quite a bit in order to guess what you mean by this, but whatever you mean your are talking about four things labeled (D3), (D2), (D1), (D0). You next say, "flipflop inputs are shown as D4,D3,D2,D1". So now you are talking about four things labeled D4, D3, D2, D1. How do these relate? Is D2 the same as (D2)?

2) You give two sets of equations, one for when x=0 and one for when x=1. But what does 'x' mean? You say this is an up/down counter, so presumably the 'x' input controls whether it is counting up or counting down. But x=1 mean, is it supposed to count up, or is it supposed to count down?

3) You have designed a set of equations for each flip flop based on knowing that if the counter is in a given state, what state you want it to move into next. So, have you checked to see, for each possible starting state, what the next state will be given your set of equations and then compared that to the desired results?

4) Before you do that, you might just look over the equations and see if they make sense based on some simple sanity check. This is merely a suggestion to help you catch some wrong solutions quickly. In your sets of equations, you have a couple that are very simple. So look at those and see if they result in the behavior you would expect. If doing so is too difficult because the desired behavior is too subtle for you to separate out, then skip it and just check the entire table.

5. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
D3 to D0 are present states and D4 to D1 are flip flop inputs..

6. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
What is D1? Is it a present state or a flip flop input?

What is D2? Is it a present state or a flip flop input?

What is D3? Is it a present state or a flip flop input?

What is the difference between the D3 to D0 that are the present states and the D,C,B,A that are the outputs?

7. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
1.D3 to D0 are just variables names. u can change these names.
2. when x=1 it is counting up and when it is counting down x=0.
3. yes. i was check it.

can u implement this then i will compare it with mine.

8. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
D3,D2,D1,D0 are the present state. D3 is the MSB and D0 is the LSB.
D4,D3,D2,D1 are the flip flop input carried out by charactestic table.

9. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
The problem is that you are using the SAME variable name for DIFFERENT variables.

If I ask you what D2 is, how will you answer is? Will you say that it is a FF input or will you say that it is the current state of one of the FF.

Thank you. I'm not convinced your equations are consistent with this, but at least now I know what you WANT 'x' to mean.

If you checked it, and if it matched the desired results, then you are done. If asked to find values for x and y such that x+y=5 and x-y=1 and you come up with x=3 and y=2, then once you check that 3+2=5 and 3-2=1, what point is there asking someone else to solve it and tell you their answers so that you can compare them.

However, I'm not convinced that you checked them, or at least not very well.

So I ask again,

Given a current state of DCBA = 0000 and X=1, which you say is for counting up, what is the next state that your equations lead to? How does that compare with what you WANT them to lead to, but what they DO lead to?

10. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
i am sending u my whole work... in few minutes ok

11. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
present state next state:
SRQP x=0 x=1
0000 0001 1001
0001 0010 1000
0010 0011 0111
0011 0100 0110
0100 0101 0101
0101 0110 0100
0110 0111 0011
0111 1000 0010
1000 1001 0001
1001 0000 0000

12. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
flip flop inputs

x=0 x=1
D4 D3 D2 D1 D4 D3 D2 D1
0 0 0 1 1 0 0 1
0 0 1 0 1 0 0 0
0 0 1 1 0 1 1 1
0 1 0 0 0 1 1 0
0 1 0 1 0 1 0 1
0 1 1 0 0 1 0 0
0 1 1 1 0 0 1 1
1 0 0 0 0 0 1 0
1 0 0 1 0 0 0 1
0 0 0 0 0 0 0 0

Last edited: May 3, 2012
13. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
Now you're throwing more undeclared signal names out there. What are S, R, Q, and P?

What happened to D,C,B, and A?

Assuming that this table matches your equations, does this match your assertion that when x=1 it is counting up and that it is counting down when x=0?

Last edited: May 3, 2012
14. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
This makes no sense to me. You have a table for x=0 and two sets of columns for the same variables with different values. What is what?

15. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
SRQP ARE PRESENT STATES and DCBA are outputs..... plz tell me the equations.

16. ### WBahn Moderator

Mar 31, 2012
24,464
7,654

I think I see part of where you are going seriously astray.

Consider just x=1. Let's assume the circuit starts out in state 0000. The next state given by your table above is 1001. Okay. Then what is the state after that? Well, now the circuit is in state 1001 and so the new state will be 0000. The circuit goes from one state to the next based on what state it is IN, not what state happens to be listed next in some table.

17. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
flip flop inputs

x=0 x=1
D4 D3 D2 D1 D4 D3 D2 D1
0 0 0 1 1 0 0 1
0 0 1 0 1 0 0 0
0 0 1 1 0 1 1 1
0 1 0 0 0 1 1 0
0 1 0 1 0 1 0 1
0 1 1 0 0 1 0 0
0 1 1 1 0 0 1 1
1 0 0 0 0 0 1 0
1 0 0 1 0 0 0 1
0 0 0 0 0 0 0 0

18. ### syedamehakfatima Thread Starter New Member

May 2, 2012
15
0
i dont know what u want to know?? i was give u each and every thing which i was do..... now plz help me

19. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
What is the difference between the present states and the outputs?

20. ### WBahn Moderator

Mar 31, 2012
24,464
7,654
Okay, so the left half applies when x=0 and the right half when x=1. Fine. Thank you.

Now, explain what each row of this table represents. For instance, let's just focus on x=0 and the fifth line (picked at random). What does:

D4 D3 D2 D1
0 1 0 1

tell me?

In answering this, keep in mind what an randomly picked row from your prior table is saying. For instance, the seventh row of that table is:

SRQP x=0 x=1
0110 0111 0011

This tells me that if the present values of SRQP are 0110 and if x=0, that the next set of values for SRQP will be 0111 while, if x=1, they will be 0011.