Gumballs cost 15 cents and the machine accepts nickels and dimes. The circuit needs to show when the Gumball Machine should dispense a gumball, and also when it should give back change.
My first attempt ended up in an extremely complex circuit that dispensed gumballs after 10 cents was put in.
I was able to simplify the circuit when I noticed I didn't use all of the don't care conditions in the k-maps to full advantage - no change still had 10 cent gumballs
I slept on it, and made it even more simple when I realized I only needed 1 input variable, not 2, making it an 8 entry truth table instead of 16.
Now my "gumball machine" will dispense gumballs after you put in 15 cents EXCEPT for the case of putting in 2 dimes, which is also the only time you have to deal with change.
I = Input, 0 if you put in a nickel, 1 if you put in a Dime
Current State Q(t)
D = Is there a dime in the machine already (2 nickels = 1 dime)
N = Is there a nickel in the machine already
Next State Q(t+1)
Dn = Next state for the dime
Nn = Next state for the nickel
C = Should change be given?
G = Should a gumball be released?
I'm using JK flip flops for this one, but the type of flip flop isn't specified.
Things are spaced a bit to make it easier to read. (I hope anyway)
I D N Dn Nn C G
0 0 1 0 1 0 0
0 0 1 1 0 0 0
0 1 0 1 1 0 0
0 1 1 0 0 0 1
1 0 0 1 0 0 0
1 0 1 1 1 0 0
1 1 0 0 0 1 1 (This is the problem child)
1 1 1 0 0 0 1
My previous table had entries like 010 00 01 but that was releasing the gumball after only ten cents. When I build the circuit based on this chart, the gumballs are releasing after 15 cents. That is, except for the 2 dimes case, and I'm not sure how to handle it - it's treating 1 dime in the machine as 20 cents providing a gumball and a nickel back.
I like figuring things out for myself, so hints are great.