Automatic Chocolate Vending Machine ( ACVM )
This example discusses the Functionality, Behavioral Description and Hardware Architecture of an Automatic Chocolate Vending Machine. The design and development of the software for this Embedded System is organized by creating 6 tasks, which perform in an Real-time Operating Systemenvironment
Functionality :
The ACVM accepts coins in the denominations of Rs. 1 , Rs. 2 and Rs.5 in three independent slots. When sufficient money is inserted, this machine delivers a chocolate. This machine should take of other possibilities like, inserting insufficient amount, inserting more amount than the cost of the chocolate etc. A Display unit should guide the buying process of chocolate.
BehavioralDescription:
(1) When a child inserts coin into the coin slot machine to buy a chocolate, the “ first coin into the machine “ generates a trigger pulse. This trigger pulse serves as a start signal for the coin slot machine’s built-in timer. This timer is designed for a 2 minute count-down, using hardware ( this 2 minute time is fixed through hardware ) . Timer’s countdown starts upon receiving the signal (trigger pulse ). The child is expected to insert balance amount within two minutes , to get his chocolate.
(2) The coin slot machine has three dedicated 8-bit registers ( R1, R2, R5 ) for denominations of Rs. 1, Rs. 2 and Rs. 5 respectively. These registers store the information bout the number of coins inserted. When the child inserts a coin – for example , a Five rupee coin, then the R5 register’s D0 bit is set to 1. If the child inserts a second 5 Rupee coin, then the D1 bit of the same register ( R5 ) is set to 1, indicating that the child has inserted 2 coins of 5 rupee denomination. As a result, the content of R5 is 0000 0011. The inserted coins are routed to a coin box for the collection by the owner of ACVM. Thus the insertion of coins in the coin-slot-machine generates data in the three registers.
(3) Within two minutes if the child inserts the balance amount ( cost of the chocolate) , the following tasks are performed :
• The coin slot machine transfers the contents of R1, R2 and R5 ( 3 bytes ) to the microcontroller through a parallel port P1.
• A software program ( task ) computes the amount received by the ACVM using the expression :
{amount =( number of 1s in R1 *1 )+( number of 1s in R2 * 2) +( number of 1s in R5 * 5)}