Vending Machine Help

Thread Starter

smokingpotnonstop

Joined May 8, 2014
21
So I have this assignment, and I'm not sure if I'm headed to the right direction. The assignment is,
"Consider a vending machine where all items cost 50 cents. The vending machine accepts only quarters. Any insertion that is not a quarter will simply drop through (by mechanical action) to the change bin and will not affect the counter or the control circuit (so the control circuit is unaware of it). Each time a valid coin is inserted, the machine must keep track of the total value of all the coins inserted for this transaction. When it has counted 50 cents, it lights a display instructing the user to make a selection. If the user attempts to insert additional coins at this point, the new coins drop through to the change bin without being counted, the display remains lit, and the machine continues to wait for a selection. There is no need for a change return. There is a “cancel” button for the user to abort the transaction. Pressing “cancel” releases all the coins captured for this transaction to the change bin, resets the count to zero, and turns off the display light. The machine is ready for the next transaction. When the user presses the selection button, the product is dispensed, and the machine is reset to its initial state awaiting a transaction. For the purpose of this problem, assume that there is only one product choice.
Note that the outputs are: (1) the display light, (2) the coin release (which empties the coin holding bin to the change chute), (3) the coin bypass (which routes coin inserts directly to the change chute), and (4) the product release. What are the user inputs?"


So far, I have this table. I'm amssuming that pennies don't exisit, and only one type of currency exists. I was thinking that there should be Don't Cares, but I'm not sure.

 
Last edited:

WBahn

Joined Mar 31, 2012
29,979
Read the instructions more closely. What does it indicate as far as anything other than quarters are concerned?

What is your "button" input?

Go through your table and ask yourself if it makes any sense at all.
 

Thread Starter

smokingpotnonstop

Joined May 8, 2014
21
The button is there that the user presses to get the soda. It said if it's not quarters it will get dropped. So I figured having the coin bypass on 1 will set it off. My teacher also said we can list assumptions. So I state that I assumed that pennies don't exisit and that there is only one type of currency. As far as light displaying, I just assumed it was a LED and it turned on when 50 cents was in. I just noticed that I forgot the cancel button. However, it doesn't make any sense when I tried to input it on the table. I revised the table, and I'm still not sure.
 

djsfantasi

Joined Apr 11, 2010
9,156
What is the second sentence of your quoted problem statement? What does it say about nickels and dimes?
 
Last edited:

WBahn

Joined Mar 31, 2012
29,979
If you are going to just assume that the LED is going to somehow light up when 50 cents has been put in, why not just assume that everything is going to somehow work like it's supposed to and be done?
 

Thread Starter

smokingpotnonstop

Joined May 8, 2014
21
It says that only quarters will be accepted. Others won't be. So I guess I don't need the Nickel and Dime input? Does that mean that I only need Quater, soda button, and cancel?
 

djsfantasi

Joined Apr 11, 2010
9,156
It says that only quarters will be accepted. Others won't be. So I guess I don't need the Nickel and Dime input? Does that mean that I only need Quater, soda button, and cancel?
I don't know; what do you think? What state determines the "coin bypass" output? Also, think about what state determines the "LED On" output?
 

Thread Starter

smokingpotnonstop

Joined May 8, 2014
21
I'm pretty sure I need it becuase it states that I need a Coin Bypass output. That's where the coins go to the change chute. But I'm really confused right now.
 

djsfantasi

Joined Apr 11, 2010
9,156
Ok, you have a quarter input. But if it's another coin, how does your machine know to activate the coin bypass? It needs to know that another type of coin was entered. Or that a coin was entered and it was NOT a quarter. So does this imply another input?

My second question regarding the LED was prompted by I don't see how you plan on determining that TWO quarters were entered.

What class is this assignment for? What level of schooling are you at? Anywhere in your education, have you learned about finite state machines? Look them up. I haven't started discussing how to approach the solution, because IMHO you need to understand the problem better.

Hope I am not coming across as rude. I am trying to help.
 
Last edited:

tshuck

Joined Oct 18, 2012
3,534
Any insertion that is not a quarter will simply drop through (by mechanical action) to the change bin and will not affect the counter or the control circuit (so the control circuit is unaware of it
If this is true, what does coin bypass do? The only thing I could think is that it causes any quarter entered to immediately be returned and never incrementing the coin count.

This seems like a problem geared toward finite state machines, but some things aren't clear. Maybe a picture of the problem statement would help clarify...
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
If this is true, what does coin bypass do? The only thing I could think is that it causes any quarter entered to immediately be returned and never intervening the coin count.

This seems like a problem geared toward finite state machines, but some things aren't clear. Maybe a picture of the problem statement would help clarify...
My interpretation is that coin bypass is an output, driving a mechanical device (read solenoid) that modifies the path of the coins, so that instead of going to the payment bin it proceeds to the change bin.
 

Thread Starter

smokingpotnonstop

Joined May 8, 2014
21
This is a intro class for digital logic. It's a college class. By finite states, do you mean state diagrams? I tried to draw one up, but not sure about 0s and 1s or if it's right.

 

djsfantasi

Joined Apr 11, 2010
9,156
Yes, this is what I mean, however it is hard to read. Can you attach it to your post so I can look at it in more detail?

First thing I noted is there is no state for a coin other than a quarter.
Secondly, you need to set the LED once $0.50 has been entered.
 

WBahn

Joined Mar 31, 2012
29,979
Guys, you are making this much harder than it is.

The problem states that any coin other than a quarter is rejected by mechanical means. Thus the electronics only see quarters.

The bypass has nothing to do with nickels and dimes. What should happen if someone puts in five quarters? The first two should be accepted and any subsequent ones should be returned. How is this done? Via the bypass output!

This is a state machine. The table needs to reflect that it is a state machine.
 

WBahn

Joined Mar 31, 2012
29,979
I did another one and added some things. Still not sure.
"Cancel" is not a state. Nor are most of your "states".

Think of the "state" as representing all of the past information about the entire history of the universe that is relevant to the problem.

For this problem, the ONLY piece of information that needs to be known in order to determine what to do is what? Hint: You only need a total of three states.
 

WBahn

Joined Mar 31, 2012
29,979
By states, do you mean the 0, 25, and 50 cents? So 0 -> 25 -> 50, and then 50 goes to 0?
That is one possible sequence of states, but there are many others.

For instance, someone puts in a quarter and then hits cancel. Or the one I asked about previously in which someone puts in five quarters. For each state, you need to identify what should happen for each possible input condition.
 

WBahn

Joined Mar 31, 2012
29,979
Don't confuse states with events.

Putting a quarter in is an event. But what you should do if someone puts a quarter in depends on the state. You do something very different if it is the first quarter, the second quarter, or the third quarter that they've put in.

Complete the following descriptions:
============================
STATE_0: No money has been put in.
============================

EVENT_Q: A quarter is put in.
OUTPUT: None
GOTO: STATE_25

EVENT_C: The cancel button is pressed.
OUTPUT: None
GOTO: STATE_0

EVENT_D: The dispense button is pressed
OUTPUT: None
GOTO: STATE_0

============================
STATE_25: One quarter has been put in.
============================

EVENT_Q: A quarter is put in.
OUTPUT:
GOTO:

EVENT_C: The cancel button is pressed.
OUTPUT:
GOTO:

EVENT_D: The dispense button is pressed
OUTPUT:
GOTO:

============================
STATE_50: Two quarters have been put in.
============================

EVENT_Q: A quarter is put in.
OUTPUT:
GOTO:

EVENT_C: The cancel button is pressed.
OUTPUT:
GOTO:

EVENT_D: The dispense button is pressed
OUTPUT:
GOTO:
 
Top