Vending Machine

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

Sequential Circuit Design

Vending Machine
Design Vending Machine Circuit
• Dispense a Coke when depositing 15 ¢
• Inputs:
– 5: 5¢ coin
– 10: 10¢ coin
– WC: Wrong Coin (all coins except 5¢ and 10 are WC)
• Outputs
– R: Reject (In case of unacceptable coins)
– C: Bottle of Coke
– N: No bottle (When money is less than 15¢)
State Diagram
Encode State Names
State Table

Present State Inputs (5,10,WC) Next State Outputs (N,C,R)


A B X1 X0 NA NB Y1 Y0
0 0 0 0 0 1 0 0
0 0 0 1 1 0 0 0
0 0 1 0 0 0 1 0
0 1 0 0 1 0 0 0
0 1 0 1 0 0 0 1
0 1 1 0 0 1 1 0
Input s Outputs
1 0 0 0 0 0 0 1 5: 00 N: 00
1 0 0 1 0 1 0 1 10: 01 C: 01
1 0 1 0 1 0 1 0 WC: 10 R: 10
Logic Circuit Design
Present State Inputs (5,10,WC) Next State Outputs (N,C,R)
A B X1 X0 NA NB Y1 Y0
0 0 0 0 0 1 0 0
0 0 0 1 1 0 0 0
NA=BX1’X0’+A’B’X0+AX1
0 0 1 0 0 0 1 0
0 1 0 0 1 0 0 0
0 1 0 1 0 0 0 1
0 1 1 0 0 1 1 0
1 0 0 0 0 0 0 1
1 0 0 1 0 1 0 1
1 0 1 0 1 0 1 0
X X 1 1 X X X X
1 1 X X X X X X

NB=A’B’X1’X0’+AX0+BX1
Logic Circuit Design
Present State Inputs (5,10,WC) Next State Outputs (N,C,R)
A B X1 X0 NA NB Y1 Y0
0 0 0 0 0 1 0 0
0 0 0 1 1 0 0 0
0 0 1 0 0 0 1 0
Y1=X1
0 1 0 0 1 0 0 0
0 1 0 1 0 0 0 1
0 1 1 0 0 1 1 0
1 0 0 0 0 0 0 1
1 0 0 1 0 1 0 1
1 0 1 0 1 0 1 0
X X 1 1 X X X X
1 1 X X X X X X

Y0=AX1’+BX0
Logic Circuit
Y1=X1
Y0=AX1’+BX0

NA=BX1’X0’+A’B’X0+AX1

NB=A’B’X1’X0’+AX0+BX1
State Table

Present State Input Next State Output


A B X NA NB Z
0 0 0 0 0 0
0 0 1 0 1 0
0 1 0 0 0 0
0 1 1 1 0 0
1 0 0 1 1 0
1 0 1 1 0 0
1 1 0 0 0 0
1 1 1 0 1 1
Logic Circuit Design Steps
• Obtain state diagram or state table as requirement
• Assign binary codes to states
• Generate a Boolean functions for
– Each external output
– Each state encoded bit
• Simplify the Boolean functions
• Draw a D F/F (or register) for each state encoded bit
• Draw logic circuits for
– External outputs
– Each inputs of state encoded bits
– Input of state encoded bits = the next state
– Output of state encoded bits = the current state
AB+A’B’ = (A⊕B)’
Logic Circuit Design
Present State Input Next State Output
A B X NA NB Z
0 0 0 0 0 0 NA = XA’B + AB’
0 0 1 0 1 0
0 1 0 0 0 0
0 1 1 1 0 0
1 0 0 1 1 0
1 0 1 1 0 0
1 1 0 0 0 0 NB = XA’B’ + XAB
1 1 1 0 1 1 + X’AB’
=X(A⊕B)’ + X’AB’

Z = XAB
Logic Circuit Design

Z = XAB

NA = XA’B + AB’

NB = X(A⊕B)’ + X’AB’

You might also like