# Digital Logic, vending machine

Discussion in 'Homework Help' started by Vaonix, Apr 14, 2015.

1. ### Vaonix Thread Starter New Member

Feb 25, 2015
11
0
Good Afternoon,

Project to build and implement in my Digital logic course. I am generally ok in lab when given the topic at hand, but when given everything at our disposal in lab im kind of flustered at what to begin with on this. This lab is entirely independent from class, and generally dont learn much from the class side of it. I feel like this would be somewhat easy to make using basic AND OR NOT gates, although probably to clunky for the test board and im sure that is not the right way to go about it.....

Code (Text):
1.
2. 100 yen   50  yen  25 yen   LED     #cookie    #change
3.   0          0         0      0         00        00
4.   0          0         1      0         00        00
5.   0          1         0      0         00        00
6.   0          1         1      0         01        00
7.   1          0         0      1         01        01
8.   1          0         1      1         01        11
9.   1          1         0      0         10        00
10.   1          1         1      1         10        10
11.

This truth table works as far as I understand it. Any point into the right direction would be beneficial.

You are required to design and construct a circuit for a cookie vending machine. The machine sells cookie for 75 Yen each. Assume that there are only 25, 50, and 100 Yen coins. Three different types of coins can be denoted by three different switches on the board, respectively. With the total amount of input coins, seven-segment display A should display the number of cookies that a user can buy. Whenever there is changeafter getting the cookie, the machine will turn on an LED to remind the users of changes. For example, ifone 25 and one 100 Yen coins are inserted in the slot, turn on the LED to signal the change. However, if one 50 or one 25 are inserted in the slot, don’t turn on the LED. That is no cookie no change.

[Bonus Points]

Display the amount of changes in the unit of 25 Yen coins on seven-segment display B as a decimal number along with the number of cookies the machine sells. For example, if the changes are 50 Yen, the machine will display the number “2”.

Thanks in advance

Moderators note : used code tags to force monospaced font

Last edited by a moderator: Apr 14, 2015
2. ### #12 Expert

Nov 30, 2010
16,705
7,358
What is the difference between, "build" and, "implement"?
If you want to build this, start with the given 3 switches and build some logic circuits to interpret what to do.
If you want to implement this, you will have to tell me more about your needs.

3. ### WBahn Moderator

Mar 31, 2012
18,093
4,918
Break it into smaller problems. First just deal with the LED part of the design and get that working.

If someone only puts in a 50 Yen coin, they don't get a cookie, but according to your table they don't get any change back, either.

4. ### Vaonix Thread Starter New Member

Feb 25, 2015
11
0
Implement is build, same difference. As far as tool at my disposal we covered the basic AND, NAND, NOR, NOT XOR etc, as well went over flip flops, half/full adders, counters(seriel and parallel), shift registers. 1 lab on IC RAM and simulating ROM

Sure, the LED can easily be K mapped to AB + BC' assuming my truth table above is correct, that should not be labeled as code above....
assuming C as 25, B as 50 and A as 100yen

Well that part was easier than my brain made it, I'll think about cookie counter while I study physics. But I basically just need binary 0,1, and 2 to enter a seven segment decoder under the above conditions it seems.

5. ### WBahn Moderator

Mar 31, 2012
18,093
4,918
Now you seem to be taking a more reasonable approach. Break problems down into smaller pieces and then tackle the smaller pieces separately. Much easier than trying to tackle everything all at once.

But as to your LED function being AB+BC', that says that anytime they use both a 100 Yen and a 50 Yen coin that the person gets change back. Well, what if they ONLY use a 100 Yen and a 50 Yen coin? Isn't that two cookies with no change?

And what about the case where they only use a 50 Yen coin? Don't they get change back since they can't by any cookies?

6. ### Vaonix Thread Starter New Member

Feb 25, 2015
11
0
Negative, as per instructions(which is the info in the italics above, directly from the TA)
no cookie, no change. But I do see what you are saying about the LED and yeah that makes no sense, must of did my Kmap wrong. Will take a look this afternoon, thanks.

7. ### WBahn Moderator

Mar 31, 2012
18,093
4,918
Ah, okay, I see what you are saying in the instructions. In that case, your table is correct.

Whenever you do a K-map (or most things, for that matter), you want to get in the habit of verifying it before moving on. It's really easy to make simple mistakes in transcribing something from a table to a map and, when you do, you then proceed to waste a whole lot of time solving a completely different problem. Better to slow down and make sure each major step is correctly set up before proceeding to process it.

8. ### Vaonix Thread Starter New Member

Feb 25, 2015
11
0
Yup, I consistently mix and match conventions, that's going to bit me in the ass on the final.

Ok, now I have AB' + AC which works as per the truth table
LED√
Cookie display
Change display.

The cookie display is a 7 segment, which gets a BDC input from its converter (IC 7447) and I only need it to say one or 2. I did separate Kmaps for the 2 digits of the cookie counter, which I can tie to the 1's and 2's input of the decoder. I need one whenever its A + BC and 2 at AB.... ok I have to change rooms now. thanks again for the help