The next natural task
would be a Stopwatch with Lap-time (mellemtid på dansk) - Please
try my solution and make your own adjustment if you like. For
instance could "Hours" be included in the time as well - but
this call for some adjustment at the Display driver in order to
select between Hours: Minutes: Seconds.
A more advanced (and
harder task) could be a combined Watch + Stopwatch with the
ability to set the Time of the Watch.
If you try to solve this
problem with ONE HUGE State Machine are you bound to fail -
(Don't even try) - However could the control-part of the watch
be formed with a State Machine (An exercise to come)
Instead must you try to decompose the Problem into natural
elements which each solves a part of the problem and are able to
interact with each others.
The Schematic of my
solution shown beneath and could act as inspiration.
|
|
|
|
The VHDL source code
for Muxdisplay_ver3 can be found here:
Muxdisplay_ver3.vhd
|
|
|
 |
The Toggle_Button3 a State
Machine which controlled by the "Button" input and
removes eventually bouncing from the contact with a
4-bit shiftregister (not part of the State Machine).
The six internal states
produces three outputs:
Toggle: Changes state for each press
of the button.
Deboun: Will be "1" when the button
pressed or else "0" (Debouched button)
Pulse: Like
Deboun but will only be "1" for one Clk period after
a press.
|
|
|

|
In order to
use the 1 kHz frequency from the MuxDisplay and
produce a 4-bit Bcd output with 1/10 of second
resolution will this be a good component to have.
The "En" input
controls the counter and Clear works asynchronous
(hence the name). Rco will be "1" when the counter
reaches 999 and En='1'
|
|
|
 |
As the En input only will
be high for one Clock pulse each second will this
counter accumulate the Second-part of the time.
The same component used for the Minutes-part as
well.
Rco will be "1" when the
counter reaches 59 and En='1' otherwise "0"
|
|
|
 |
This component produces a
"Running light" at the leds in order to present the
1/10 of seconds.
Consider if this
functionality should be placed elsewhere in the
diagram.
|
|
|
 |
In order to "freeze" the
display for presentation of a Lap-time will the best
solution properly be a x-bit Latch which allows the
time-data to pass by under normal condition and hold
the display each time the Latch high.
|
|
|
 |
Just as an extra feature
would it be nice to have the display-dots perform
some kind of blinking in order to indicate the
different states of the Watch.
|
|
|