# Counter circuit with D Flipflops and an adder

Discussion in 'Homework Help' started by Werbenjagermanjensen, Nov 12, 2014.

1. ### Werbenjagermanjensen Thread Starter New Member

Nov 12, 2014
3
0
Hi,
I am supposed to make a counter that makes this pattern:
0, 8, 9, 10, 11, 12, 13, 7, 8, 9....
Starts at 0, jumps to 8, counts until 13 and then goes to 7, and so forth.
Here is the design I come up with in Microcap

This was the truth table:

and the equations I came up with are:
B3= S3.S2.S0 + !S3.!S0
B2 = 0
B1 = S3.S2.S0
B0 = S3.!S0 + S3.!S2 + S1
Here is what happens when I put it to test

I suppose this is a bug in Microcap or something, since the same thing happened when I tested the reference design given by the professor.
I have yet to build it since I am missing a par components that I'll buy tomorrow, but since I'm time constrained I'm asking now whether someone can see an error in the design.

For reference, here's the reference given:
Starts 0, goes to 9, counts to 10, goes back to 7 and so forth. 0, 9, 10, 7, 8, 9 ,10, 7...

I'm also supposed to make a decade counter, but Ive yet to design it, but I'd guess that making it so that when it reaches 10(1010) it lights up the clear, therefore starting again at 0, am I right?

2. ### WBahn Moderator

Mar 31, 2012
20,225
5,749
Your description of the pattern your counter is supposed to make is incomplete. There is not enough of it to make sense of "and so forth". After it jumps to 7, how far up does it count and what does it jump to after that. Without more states, the only thing it could do would be to count 0,[8,9,10,11,12,13,7], repeating the pattern in square brackets indefinitely. Is that what it's supposed to do?

3. ### Werbenjagermanjensen Thread Starter New Member

Nov 12, 2014
3
0
Yes, 0, 8, 9, 10, 11, 12 ,13 , 7 , 8, 9 10 11 12 13 7 8 9...

4. ### WBahn Moderator

Mar 31, 2012
20,225
5,749
I don't understand what you mean when you say it is doing the same thing when you give it the reference design. The reference given is doing exactly what it is being told to do, namely count in the sequence 0,[9,10,7,8]. There doesn't appear to be anything wrong with the simulator (based on the reference).

I notice that the reference has delay models. Are you using them in your design? If not, then you may very well be having setup/hold time violations. Remember, feedback sequential circuits RELY on there being sufficient delay between the outputs changing after one clock to when the inputs change in preparation for the next clock.

5. ### Werbenjagermanjensen Thread Starter New Member

Nov 12, 2014
3
0
I'm sorry, I wasn't clear, the reference results image is already given, when I tried to replicate it myself it didn't work properly, as didn't my design.

But I've just built it on a breadboard and it worked well, fortunately; so I just probably didn't configure Microcap correctly, even though I followed all teh instructions given by the professor.

All in all, thanks for trying to help me. Have a nice day!

6. ### WBahn Moderator

Mar 31, 2012
20,225
5,749
Look at ALL the differences between your implementation and your instructor's implementation in the image. Do you see the Delay Model statements? Are those statements in YOUR simulation? If not, put them there and see what happens.