Professional Documents
Culture Documents
J. Ahmed Camacho
November 30, 2011
Design Process
A circuit was designed that would implement the function of a vending machine controller. The
machine was designed to accept 10 and 25 coins. In addition, the machine dispensed items
priced at 10 (item A) and 25 (item B), when the respective amount of money was inputed. If
the user attempted to select an item without having inputed the correct amount of change, the
machine simply did nothing until a valid action was performed. The machine accepted coins up
to the price of the most expensive item (25). In other words, if the user inputted 30 the
machine returned 5 in change, retained 25, and waited for the user to perform an action (select
A, select B, request change, or input more money). If the user deposited a total of 25 and then
deposited another coin, the coins were immediately returned as change so that the outstanding
balance was never more than the maximum price. Figure 1 depicts an overall representation of
this machine.
Dispense A
D
Dispense B
Q
Change 5
SEL A
Change 10
SEL B
Change 20
The vending machine controller was designed as a Mealy machine. In other words, the outputs of
the machine depended on the inputs. The vending machine controller was first implemented in a
finite state machine Figure 2.
1 0 0/ 00
/0
00
01
00
/0
00
0
1/
0/
0
1/
00
010/010/00
1
1/
0/00
S3
25
01
0 1 1/
101/
00
1/
0
1 0 0/1
/0 0
0
0
1 / /1 1
00
0 1 0/
1/ 00
001
S2
20
10
00
0 0 0/ 0
0/
10
0
1/ 0
1
0 1/
10
01
00
0/
00
10
0/
11
1/
01
00
0/ 0
10 1/ 1
10
011/010/10
101/001/00
00/
S0
0
0
/0
0
00
S1
10
0 /0
0/00
00 00/0
0
0/0 0 0 /
The following set of tables further defines the finite state machine:
S0
S1
S2
S3
State Assignment
0
0
10
0
20
1
25
1
Item Assignment
A
1
0
B
1
1
0
1
1
0
Change Assignment
0
0
0
0
5
1
0
0
10
0
1
0
15
1
1
0
20
0
0
1
25
1
0
1
Input Encoding
Dime
0
Quarter
0
Select A
0
Select B
1
Request Change 1
0
1
1
0
0
1
0
1
0
1
With the use of the state diagram, the state assignments, change assignments, item assignments,
and input encoding, the following tables were constructed:
State
Q1 Q0
0
0
1
1
0
1
1
0
001
0 1
1 1
1 0
1 0
110
d d
d d
d d
d d
111
d d
d d
d d
d d
The state transition table demonstrates the transition of states based on the user input. For
example, if the machine is at state 01 (contains 10) and the user decides to input another 10
(input 001), the machine will now move to state 11 (containing 20). The first column of each
block represents Q1*, while the second column represents Q0*.
3
State
Q1 Q0
0
0
1
1
001
0 0 0
0 0 0
1 0 0
0 1 0
0
1
1
0
010
0 0 0
0 1 0
0 0 1
1 0 1
Change Table
Inputs X1 X2 X3
011
100
101
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0 1
1 1 0 0 0 0 1 0 1
110
d d d
d d d
d d d
d d d
111
d d d
d d d
d d d
d d d
The change table demonstrates the amount of change to be dispensed based on the input. For
example, if the machine contains 25 (state 10), and the user selects item A to be dispensed
(input 011), the machine will return 15 in change (output 110). The first column of each block
represents C1, the second column represents C2, and the third column represents C3.
State
Q1 Q0
0
0
1
1
0
1
1
0
001
0 0
0 0
0 0
0 0
010
0 0
0 0
0 0
0 0
Dispense Table
Inputs X1 X2 X3
011
100
101
0 0 0 0 0 0
1 0 0 0 0 0
1 0 0 0 0 0
1 0 0 1 0 0
110
d d
d d
d d
d d
111
d d
d d
d d
d d
The dispense table demonstrates the item being dispense based on the input. For example, if the
machine contains 10 (state 01), and the user selects item A to be dispensed (input 011), the
machine will dispense item A (output 10). The first column of each block represents D1, while
the second column represents D2.
After the tables were carefully analyzed, a software program called Espresso was used to
minimize the logic and determine the following equations:
Q1*
PRE
Q1
Q0*
Q1
CLK
CLR
PRE
Q0
Q0
CLK
CLR
CLK INIT 1
Q0
Q0
Q1
Q1
X1 X2 X3
C1 C2 C3 D1 D2
U1
7474
U2
7411
3-Input
AND
D-Flip Flops
U3
7408
2-Input
AND
U4
7432
2-Input
U5
7404
INV
U6
7414
SCHMIDT INV
OR
Results
The vending machine controller performed exact to its design. The controller changed states,
gave change, and dispensed items appropriately. Each input/output case was carefully tested and
deemed to be in working condition.
Conclusion
In the end this was a very educational assignment. The project provided a small insight into how
designing a real-world machine is like. This project was very fascinating because it allowed
students to design and implement the entire circuit from scratch. It was an appropriate end-ofcourse project because it required knowledge in all the topics taught in class (such as logic gates,
logic minimization, combinational and sequential logic, etc.). In conclusion, this project may
make one think about more complicated vending machines that accept more types of currency
(or even tap into students Board Buck accounts) and dispense several items. In a broader
viewpoint, it may even make one think about more complex machines such as computer systems
and how they may have been implemented.