Forum Discussion
Altera_Forum
Honored Contributor
10 years agoVending Machine
Hi there. I have a school project which consists in a vending machine that has 3 products ( diferent prices) and i can only use 4 type of coins. My idea is to make a FSM ( where each state eq...
Altera_Forum
Honored Contributor
10 years ago --- Quote Start --- It's probably better keep a total, say a 16 bit number of cents. What you have will use up quite a few resources. Fewer resources = cheaper chip. What happens in your design when someone puts $2.25 or $5.00 in the machine? Edit: Fewer resources is relative. Your code as it is now will fit in any modern CPLD. It's better to learn to be frugal with resources at all times. It is always easier to design for fewer resources in the first place than it is to trim down a design that is using too many. --- Quote End --- This is a school project, i can't use $5.00 ( five dollars ? we use euros) because we have some restrictions, like, i can only use 4 coins (and i chose 0.10€, 0.20€, 0.50€ and 1.00€) and I can only have 3 products, with random prices, so i thougt that the max price that someone can put in the machine was 2.10€, since the the product with the highest price is 1.20€.