ECE212
Vending Machine Example
Clay Gloster, Jr.
1 Vending Machine Example
You are to design a vending machine. The vending machine accepts nickels and dimes only and only contains one product gum that costs 0.15. Since the machine takes only nickels and dimes, it has two inputs (N and D). The machine can either dispense nothing, dispense gum, or dispense gum and 0.05 change. Design the vending machine using J-K flip-flops. Use state minimization to reduce the number of states and use the state assignment heuristics presented in class to justify your state assignment.
The block diagram and state diagram of the vending machine is shown in Figure 1.
Figure 1: State Diagram for the Simple Vending Machine.
Figure 2: Implication Table for the Simple Vending Machine.
The corresponding state table is given by Table 1.
Table 1: State Table for the Simple Vending Machine .
We use the implementation table method for state minimization which results in the following final implication table. The table is shown in Figure 2. We see from the table that states (S0,S4,S5,S6,S7,S8) are all equivalent and will be replaced by the state S0'. Also, states S2 and S3 are equivalent (to be replaced with S2').
The resulting state table after state minimization is shown in Table 2.
Next we must perform state assignment using the guidlines that were presented in chapter 9 of the text. To encode 3 states, S0' S1, and S2' using the minimum number of state bits or flip-flops, we requires 2 state bits.
We select S0' as the reset state, therefore, S0 is assigned the value AB=00.
The high priority heuristics says that S1 and S2' should be adjacent, since they both have the same next state (S0') under the input DN=10.
The medium priority heuristic says that s1 and s2' should be adjacent, since they are both the next state of the state S0'. It also says that S0' and S1 should be adjacent since they have the same output( =00) under the same input condition DN=01. We will not enumerateany more potential adjacency pairs since we have enumerated all of the possible pairs.
Therefore, attempting to meet the above constraints in priority order, we selected the state assignment:
Using the previous state assignment, the encoded state transition table is as shown in Table 4.
Since the problem states that we must implement this vending machine using J-K flip-flops, then we must use the excitation tables for J-K flip-flops to obtain the excitation table for the vending machine shown in Table 5.
Using K-Maps, we get,
Table 2: Reduced State Table for the Simple Vending Machine
.
Table 3: State Assignment for the Simple Vending Machine
.
Table 4: Encoded State Table for the Simple Vending Machine
Table 5: Excitation Table for the Simple Vending Machine using J-K flip-flops.