| With the rapid development of economy and science and technology, automatic vending machine is increasingly recognized as a new service way by people.Currently, the function of automatic vending machine on the market is simple, and the food safety can not be guaranteed. These factors greatly limit the development of automatic vending machine. In order to meet the needs of customers, we design a master-slave control system of the automatic vending machine based on STM32 and uC/OS-II real-time operating system.Firstly, this paper introduces the development of self-service industry and dairy products at home and abroad, analyzes the shortage of the existing automatic vending machine on the market. Secondly, according to the functional requirements, the control system of automatic vending machine is divided into two control modules,and we complete the circuit design and software programming of two control modules. Finally, we debug the equipment on the whole system.The hardware circuit is divided into two parts, main controller module and slave controller module, they communicate through 485 communications. This part analyzes the overall structure of the automatic milk selling system, defines the division of the master-slave controller, and completes the circuit design of each functional module of the controller. Meanwhile, this part gives a detailed description of the power supply module, ADC temperature measurement module, power supply module and voice broadcast module.In order to improve the reliability of the system on the software, we have ported the uC/OS-Ⅱ embedded real-time operating system on the STM32 chip of the main controller, and we completed the driver of GPRS/485 communication, ADC temperature measurement, IC card and screen display module and system task program. The slave controller controls product production module. Due to the simple function, this structure uses the traditional embedded system to complete the software part. In addition, in order to ensure the accuracy of communication, we made a detailed agreement on the GPRS/485 communication protocol.Finally, we have tested some functional modules of the machine, the results show that the design of the automatic control system has reached the basic requirements. |