/Thai_Baht_Vending_Machine_Calculator

This code is designed to operate a simple vending machine using a PIC 16F877 microcontroller. It can handle coins of different denominations and calculate the amount of money inserted into the machine.

Primary LanguageCMIT LicenseMIT

Thai Baht Vending Machine Calculator

Description

This code is designed to operate a simple vending machine using a PIC 16F877 microcontroller. It can handle coins of different denominations and calculate the amount of money inserted into the machine. The program also displays the amount of money inserted and the number of coins inserted for each denomination on an LCD screen.
2017

How to use

1. Set up the hardware (PIC microcontroller, LCD screen, and coin sensors) and connect them to the appropriate pins on the PIC microcontroller.
2. Compile and upload the code to the PIC 16F877 microcontroller.
3. Once the code is running on the PIC microcontroller, users can insert coins of different denominations (1, 5, or 10 baht).
4. The program will keep track of the number of coins inserted and calculate the total amount of money inserted.
5. The amount of money inserted and the number of coins inserted for each denomination will be displayed on the LCD screen.
6. To reset the amount of money inserted and the number of coins inserted, press the reset button on the hardware.

Code explanation

The program begins by initializing the hardware and setting up the LCD screen. The 'main' function then enters an infinite loop where it checks for coins inserted by the user. If a coin is detected, the program updates the appropriate counter for that denomination of coin. The 'LCD' function is called to update the LCD screen with the new values of the counters.

The 'LCD' function takes the values of the counters and converts them to strings using the 'itoa' function. It then uses the 'lcd_gotoxy' and 'lcd_putc' functions to display the values on the LCD screen. The 'ClearLCD' function is called to clear any previously displayed values before updating the screen with the new values.

Future improvements

The current program is limited to handling coins of three different denominations. Future improvements to the program could include adding support for more coin denominations, adding the ability to dispense items based on the amount of money inserted, and improving the user interface to make it more intuitive and user-friendly.

License

This code is licensed under the MIT License. See the LICENSE file for details.