# How do you design a counter that show the result for 5 second

#### Foxief

Joined May 1, 2023
1
I have this problem given by my teacher, but cant figure out the part where i need to show the result for 5 second

Design a 3-digit counter, the counter will count for 20 seconds and display the counting results for 5 seconds then reset automatically and start counting from zero

This is how i try to approach it

#### ericgibbs

Joined Jan 29, 2010
18,032
Hi Fox,
Welcome t AAC.
As this is Homework you have to show your best attempt at answering, we can then help.
E

#### WBahn

Joined Mar 31, 2012
29,165
Forget about electronics for a bit and focus on the problem.

Write out a sequence of things that needs to happen.

What is the total period for the behavior that your circuit needs to exhibit?

#### panic mode

Joined Oct 10, 2011
2,505
perhaps make a clock that is 20seconds high and 5 seconds low.
while it is high, allow counting. on rising edge clear counter.

#### crutschow

Joined Mar 14, 2008
32,915
As WBahn noted, write out the sequence of events, that you need, and then you can design the circuits to do them
I see at least four distinct events and you are addressing only two of them.

#### WBahn

Joined Mar 31, 2012
29,165
When you get to coming up with an implementation for your solution, what you show indicates that you are going to try for a circuit that involves a lot of asynchronous logic (using logic gates to generate clock signals and using asynchronous set and reset inputs as a core part of your logic design). Sadly, this is often how this stuff is taught, but there are lots of demons hiding in those waters and they never teach you how to identify and slay them. I would strongly recommend that you use a fully synchronous solution in which every part that has a clock input gets that same, clean, free-running clock and the asynchronous inputs to those parts are not used. That's the ideal. Then consider deviations from that only if they are truly warranted and be sure that you analyze those deviations extremely carefully in terms of response to glitches and race condition. If the deviations are few, this becomes a practical task.

#### crutschow

Joined Mar 14, 2008
32,915
the asynchronous inputs to those parts are not used.
Except for the asynchronous inputs that may be required, such as counter reset.
Of course, those can be made synchronous, if necessary, by driving them from a flip-flop.

#### WBahn

Joined Mar 31, 2012
29,165
Except for the asynchronous inputs that may be required, such as counter reset.
Of course, those can be made synchronous, if necessary, by driving them from a flip-flop.
That's still a deviation from a fully-synchronous design. Driving them with a flip flop can actually exacerbate the situation by creating race conditions between the edges of the clock and when the asynchronous input is relaxed. These can usually be dealt with, the problem is that many people don't bother to think about them or think about them too superficially.

When using off-the-shelf parts, you might have to use the asynchronous inputs because the part doesn't have the inputs that would be needed to do a fully synchronous design. Arguably, this just says that you are not using the right parts. If you need to reset a counter, the fully-synchronous way to do it is to load a zero via its synchronous load inputs. If it doesn't have such inputs, get one that does (if it exists).

That's in the ideal world. In the practical world, compromises must be made, which means that we might choose to use the asynchronous inputs even when fully-synchronous alternatives are available. That's reality. But making that choice also means we take on the responsibility for vetting the design as an asynchronous design and dealing with the demons that come with such designs.

In this case, using something like the 74xx163 might be a good option.