Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

help me through vhdl code

Vending machine

The vending machine dispenses two items: a can of soda or a candy bar. The can

of soda costs $7 while the candy bar costs $4.

1. There is an input select for each product and a reset input that takes the machine

to the idle state.

2. The machine only accepts $1 and $5 bills.

3. When sufficient funds have been inserted, the product selection is made. The

maximum amount of money that can be inserted is $10.

4. Change is dispensed but only in $1 bills.

5. If a product selection is made and insufficient funds have been inserted, the

machine illuminates an “insufficient funds” display and waits for more money to

be inserted.

6. The transaction can be cancelled at any time with the appropriate refund.

7. If the product is not available, all money is returned.

8. When a product is dispensed the customer must take it before a new transaction

can start.

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you talk about Algorithmic Machine, you can use FSM approach. Try stateflow from Matlab. Good luck

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Sounds like a good project - please ask any questions when you get stuck writing code..

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'd suggest to design your state machine on paper first, defining your different states and transitions. Then it will be easier to translate it into VHDL code.

    As I side note I find those prices expensive. If the point is to prevent people from eating and drinking unhealthy food you should also consider distributing fruits and vegetable snacks.