Homework X, a Vending Machine
Objectives
We would like to :
- Develop a circuit that can serve as the basis for a vending machine.
Discussion
You are living an Danland, where there are four coins
- The 1 Danari coin
- The 5 Danari coin
- The 10 Danari coin
- The 25 Danari coin
You are to develop a simple circuit for a vending machine. You should assume the following:
- You have a device that will detect coins as they are deposited, it will provide the following input:
- cv, a two bit line containing the coin last deposited
-
| CV | Coin Value |
| 00 | 1 |
| 01 | 5 |
| 10 | 10 |
| 11 | 25 |
- cd, a one bit line indicating that a coin has been deposited.
- You can assume that when cd raises from 0 to 1, the data on cv indicates the coin value.
- If you are interested, this video shows someone making a device that could do this.
- A button selector
- With a choice of 7 buttons (labeled 0 - 7)
- And a button labeled vend.
- This produces two inputs to your circuit
- vs a 3 bit line that indicates the user's choice 0-7
- v a 1 bit line that goes from low to high when the user wishes to make a purchase.
- You may assume that when the v line rises from low to high, the vs lines contain a valid value representing the user's selection.
- You should support an additional reset line, that resets your circuit.
- Your circuit should contain a memory that contains product descriptions. For each of the 8 products, this should include
- A three letter description
- An 8 bit price, nothing can cost more than 255 Danari (The plural of Danari is Danari), however for simplicity do not make any item cost more than 127D
- In my test machine, I supported the following products
| Code | Description |
| 0x43414e64 | 100D CAN |
| 0x4341527D | 125D CAR |
| 0x43415401 | 1D CAT |
| 0x444f477f | 127D DOG |
- Your circuit should only work up until an item has sufficient coins deposited to purchase the item, you do not need to make change.
- Your circuit should support the following input buttons
-
- Item Selection simulates vs above
- Vend simulates v above
- Coin Value simulates cv above
- Coin Deposited simulates cd above
- Reset is the 1 bit reset line, and resets the entire machine on 1.
- In this case, the customer has selected item 0, and has deposited one coin of type 2 (10D coin)
- You circuit should display
- The current item selected (as pictured above, bot text and price)
- The State of the machine
-
- Selected Cost: the cost of the item currently selected, set only after Item Select has been pressed.
- Amount Deposited: the amount the customer has placed in the machine
- Deposit More Coins: red when the customer has placed insufficient funds to make the current purchase.
- Deliver Goods: red when the customer has placed exactly the correct value of coins or more for the current purchase.
- Change Due: red when the customer has placed a larger value of coins than the value of the current purchase.
- In this case, the customer is purchasing a 100D item, has deposited 65D value of coins.
Notes
- Use only circuits/components we have discussed except
- You may use the comparator (under Arithmetic)
- You may use the constant value (under wires)
- You may use an adder and/or a subtractor
- Item price changes as the customer scrolls through the items.
- Selected cost changes only when the customer selects vend.
- You should have 8 items in your inventory, the first four should match mine.
- I only used three or gates, everything else was accomplished with components.
- Don't make any price higher than 127D
- Don't worry about overflow.
Submission
Submit a single .dig file to D2L by the due date.