Update: The right hand side of the circuit reflects the change system for money inserted vs the cost of the desired item. The core of this change system was a subtractor, with muxes for inputs and and gates for enable bits. The subtractors were built with a 74283 adder with the cost of the item being the second input which was xor'd. I utilized muxes for the inputs to the subtractors with the entered control bits. This would then choose the hard coded price binary digits for the inputs to the subtractor. These muxes just contained the preset costs for the items in order. The output of these muxes then went into the subtractor as the second input that was xor'd with vcc, with the top being the MSB and lowest mux being the LSB. The output of this subtractor was sent to an and gate with an enable pin, this was checking that the item could be purchased using the output of the first mux to ensure there was no incorrect output when the amount inserted was less than the cost. The final output on the right was a green led on the left to signify the item could be bought, and 4 leds on the right corresponding to change output, MSB -> LSB.
Menu:
Energy drink: 00 input, $8 cost
Gatorade: 01 input, $11 cost
Coffee: 10 input, $12 cost
Water: 11 input, $5 cost
The circuit is below:
This circuit replicates a simple function of a vending machine. The left inputs correspond to a four bit binary number of money inserted into the machine, as well as a two bit binary input to indicate the desired item to purchase. The four bit input is put into four decoders and the decoders are utilizing nor gates for decoders with fewer maxterms(Energy Drink and Water), and or gates for decoders with fewer minterms(Gatorade and Coffee). Nand and And gates are not used as active high output decoders are being used in this circuit. Truth table rows were chosen based on Input >= Amount for item, with each truth table row directly relating to the dollar amount of the item. These decoder outputs are then fed to a 4-1 mux with the two bit choice input, and thus only the signal of the desired item will be emitted.
This is a decoder mux circuit displaying how decoders can replicate truth tables with certain logic gates as well as how a mux can be used to facilitate a choice from the user.
To the left is the circuits truth table for all four decoders.(Not the change output)
A,B,C,D correspond to the 4 input dollar amount
E,F correspond to the mux input or item choice
Y is the final LED output