3 second countdown increment

MisterBill2

Joined Jan 23, 2018
27,553
My point was, and still is, that a preset counter counts down from the preset starting number, so altering that number after it starts has no effect..
So the scheme will need to be rather different, with the initial number in a register, and then every second remove one count from that register, and every button push add three counts to the register. So there would not be a counter, which is good, because it can not be done with a counter.
Do the flow chart and see that is true.The display shows a register value, and that is both decremented and added to.
It just took me a bit to realize that.
 

WBahn

Joined Mar 31, 2012
32,871
You could have the circuit always present to the preset inputs the current output plus three. Then all pressing the button does is load the counter with the current value at the preset.

There are still some demons involved, because it is an asynchronous circuit and so what happens if the button is pressed too near the clock that is causing the counter to count?
 

WBahn

Joined Mar 31, 2012
32,871
Hllo,

Hello, it doesnt matter if it changes at half a second, the important thing is that it adds the seconds instantly after a button or switch is activated. It does not matter if it is exactly fine tuned to the clock, as long as it can count
This doesn't quite flesh out the required behavior. So let me ask a couple more questions to try to get at what is needed.

Say the display changes to 18 and then, maybe a tenth of a second before it would normally change to 17, the person pushes the button. Let's say the display changes immediately to 21. When should it change to 20? A full second after the button was pressed, or a tenth of a second later at the time when it normally would have changed? Does it matter which way it behaves, keeping in mind that, in the extreme, the person may perceive that pushing the button only incremented the count by 2 because what actually happened was that it incremented it by 3 but then it was immediately decremented.

The other situation that hasn't been spec'ed is what needs to happen in the case of multiple presses. Say the display changes to 18 and then, 0.25 s later the button is pressed and the display immediately goes to 21. But not 0.25 seconds after that, the button is pressed again. Should it now go to 24? Or should only one button press per time interval be acted upon?

Regardless of what you do, you are going to need to very carefully consider what happens if the button is pressed while the counter is in the process of counting down. The outputs upon which you are going to do your arithmetic are changing and you can't count of them changing instantly at the same time -- some bits will change before other bits. The result is that, occasionally, the person will press the button and the display will change to a seemingly random value.
 

WBahn

Joined Mar 31, 2012
32,871
A flip-flop registers that the button is pressed.
On the next mid-cycle transition, three pulses are injected.
Except that doesn't align with the requirement the TS has given that the change be immediate. I'm interpreting "immediate" to mean that the person pushing the button perceives no delay in the response. Registering the input and delaying action across a critical span to ensure stable inputs during setup/hold times would probably not be perceivable. It may also run afoul of a requirement that the circuit respond to multiple button presses in close succession (that still hasn't been nailed down).

Also, consider the case where the button is pressed in the second half of the cycle. The display would then count down at the end of the cycle normally, and then count up by three (or would it be four, since the value has changed -- depends on which value is used to determine the new value to be loaded) half a second later. You would expect to see this behavior half of the time, and I doubt it would be acceptable (but the TS needs to determine and specify what is and what is not acceptable).
 
Last edited:

MrChips

Joined Oct 2, 2009
34,820
On second thoughts, you don’t have to wait for the next mid cycle. The three pulses can be injected at any time other than when the 1-second pulse is present. Make the 1-second pulse as short as possible.
 

MisterBill2

Joined Jan 23, 2018
27,553
Of course what is totally missing is any description of the purpose of the whole application. Is this for a rocket launcher? Or some sort of toy? or a control for cooking time in some sort of device? Or maybe some sort of kinky application.
I have seen a microwave oven with an "add a minute" button, it might be something like that.
Does the accuracy need to be microseconds, or minutes? We have no clue.

Creating a detailed flow chart of each action was a great way to realize what schemes would not work. That is how I arrived at the register scheme suggested in post #21. I think it can be implemented in LS-TTL that may still be available. Probably not simple, but able to be produced.
 

corasan

Joined Jul 18, 2023
35
Hello, let me clear things out on behalf of TS. This was a digital logic design project for a coin-paid counter. Basically, the requirement of the circuit is to count down from a maximum of 30s; the initial count is 3s. Each coin (represented by a button press) adds 3s to the timer, so if the button is pressed 11 times quickly, it should preset a total of 30s; not 33s since it is >30s. It is an asynchronous design, meaning the timer should continue counting down even if the button is pressed.
 

MisterBill2

Joined Jan 23, 2018
27,553
OK, then the solution is an up/down counter that has both count up and count down inputs, and is presetable. That did exist at one time, it might have been a CD4516, a "presettable binary up-down counter."he count down clock would be the dispense time base while the much faster "load 3 more seconds" up-count would need to be much faster. Or maybe the total time can be set prior to starting the delivery.
 
Top