22-04-2011, 10:01 AM
[attachment=12596]
Introduction
• A vending machine is a system which accepts a coin and dispenses the product we want.
• The idea of vending machine is implemented through a state machine.
• A finite state machine, so names because the sequential logic or flip-flops that implements them can be in one of a finite number of possible states.
Vending Machine Design and Main Modules
Coin Insertion – monitors coin input including nickels, dimes, quarters, and dollars and communicates coin type and coin value
Item Selection – monitors row selection and column selection
Change Dispenser – outputs the appropriate amount of change
Vending Machine Control – keeps track of the numeric insertion value, price of selected item, and controls the flow of the vending machine from coin insertion to item selection to item dispensed and change dispensed
Coin Insertion
• The coin insertion module is used when we insert a coin for a particular product that we want.
• The inputs to this module are the coin type and coin value and in addition to it we have the clock and reset signals.
• The outputs from this module are the coin type and value.
Item Selection
• The item selection module determines the particular produt and its price.
• The inputs to this particular module are clock and reset signal.
• In addition to this are cancel selection which is used to cancel a product and selection done signal for making final selection.
• There is also a row and column selection for selecting a particular row and column.
• The outputs from this module are the item selected and its price.
Change Dispenser
• The change dispenser is used to dispense the change to the user.
• The inputs to this module are CLK, reset, Initialize – initialize coin registers, reset dispenser – communication from main module.
• Other inputs are dispense ready – signal indicating change ready to be dispensed, dispense value – signal determining the amount to be dispensed, max_price_met – signal indicating that the maximum amount of change has been inputted, any further change will be dispensed
• Outputs of this module are out_coin_type – signal indicating the type of coin dispensed, dispense finished – signal indicating that the dispense routine is finished, no_more_change – signal indicating that no more change is left in the machine
Main Module
• This module controls the all other modules.
• All the above three modules are controlled by this main module.
• The inputs to this module are CLK, reset, coin type (from coin insertion module), coin out (from coin dispenser module), item select, item row.
• The outputs of this module are Dispensed item, Dispensed change,
Not enough change indicator, Exact change indicator.