
332 Chapter 5
From this, we know what variables the system will require, the algo-
rithm for the AM/PM versus military timer conversion, the format of the
hardware to be driven, and the individual states of the state machine.
Let’s start with the state decoding. The range of states is 0–7 inclu-
sive, so we can use an unsigned CHAR to hold the state of the state
machines. Remembering our naming convention, we name the state
variable Display_state. Based on the state transitions listed in the design
documentation from the last chapter, we can build a basic state decoder
with the appropriate state transitions. The following is one example of
how this ...