0
\$\begingroup\$

Full context: I am building a stopwatch / countdown timer. The design is that there will be up/down counters that increment/decrement the time. The counters are then connected to 7-segment displays to show the time in the format hours:minutes:seconds. There are 5 buttons in the system: play, pause, reset, save and load. Pressing play will start/continue the stopwatch/timer. Pressing pause will pause it indefinitely. Pressing reset will reset the counter into 00:00 and pause it. Pressing save will save the values and pause it indefintely. Pressing load will load the latest saved values and pause it as well indefinitely.

I have made the modulo 10 4-bit counters and modulo 6 3-bit counters which counts up from 0 to 9 and 0 to 5 respectively. The operations in the system that works already are: play, pause, save, and reset. I have troubles implementing the load operation. The play, pause and reset operations are relatively easy so we move on to the save operation.

First, here is a diagram of one of the 4-bit counters:

0-9 Counter

It is connected to this subcircuit that saves the states into four registers.

Save-Registers

The saving is done by sending a clock signal onto four registers (in the 2nd picture). So if the counter is on state 4 (0-1-0-0) and the save button is clicked, there will be four registers that have the value 0, 1, 0, and 0 respectively. The issue is I also need to load this saved state back into the counter. Imagine 3 more ticks after saving, the counter is now on state 7 (0-1-1-1). If I click the load button, the flip flops should be back to the saved state 0-1-0-0. I am having troubles coming up with a way to overwrite the state of the flip flops with the saved values.

Is loading values back on the flip flops possible or do I need something else?

\$\endgroup\$
4
  • \$\begingroup\$ Note: This is only a subcircuit. The clock pin is fed with a signal by a clock on the main circuit. An expression is fed onto the pause and reset pin (there are other stuff that pauses and resets this counter). However, the save and load button is exclusive only to this subcircuit. \$\endgroup\$
    – Monique_S
    Jun 11, 2022 at 17:33
  • 1
    \$\begingroup\$ I don't know. I guess I'm confused by the writing and the diagram. If you have a 4-bit counter, you need 4 bits for that. If you want to save the counter value somewhere, you'll need 4 more bits for that. But I don't see them. But you say this is a subcircuit. So there is other stuff. Perhaps the saving register is over there. I don't know. And the larger context is glossed over. You talk about other stuff, listing them out, then say they are "not really relevant." But perhaps they are. Anyway... I want the full context. Not just a subset. So I'm backing off with my best wishes. \$\endgroup\$
    – jonk
    Jun 11, 2022 at 18:31
  • \$\begingroup\$ I added the full context if you're still down. I added the saving register subcircuit picture as well. The issue is I can't figure out how to load the values back into the counters once they are saved into registers. \$\endgroup\$
    – Monique_S
    Jun 11, 2022 at 19:04
  • \$\begingroup\$ I'm wondering about something like this to support reading and writing to the register. That took me just a moment to write out. What do you imagine for load/store? \$\endgroup\$
    – jonk
    Jun 11, 2022 at 19:16

1 Answer 1

0
\$\begingroup\$

I'll provide an example of how to do this. I won't use your counters, though. Partly, my reasoning is that you mention counting both up and down and I don't really see that capability in what you show, schematically. Partly, because I want to focus on the save and restore behavior and not on how the counter works. So, instead, I'll use a 4-bit synchronous binary up-counter made from DFFs to keep things simple and symmetric:

schematic

simulate this circuit – Schematic created using CircuitLab

When \$\overline{\text{LOAD}}\$ is inactive (HIGH) then clocking \$\text{COUNT}\$ advances the counter. During this time, clocking \$\text{SAVE}\$ copies the counter's value into a register used to save the current count value. When \$\overline{\text{LOAD}}\$ is active (LOW) then clocking \$\text{COUNT}\$ loads the counter value from the saved count value.

That should provide a sufficiently detailed approach that will allow you to work out how to apply it in your cases.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.