With the tide of industrial automation and intellectualization coming, people’s life style has changed dramatically. People’s medical environment and medical equipment have further realized intellectualization. This paper mainly uses STM32 microcontroller to control the dispensing device of automatic dispensing machine through CAN bus. The dispensing device of traditional dispensing machine is mainly connected. Through PLC technology to achieve control [1], but the line of PLC itself is very complex, which ultimately makes the dispenser appear very large and bulky, on-site assembly is also time-consuming and labor-consuming automation is not high, and the cost of PLC control devices is very high, which seriously restricts the market-oriented development of automatic dispenser. Therefore, the STM32 microcontroller used in this paper can effectively solve the related shortcomings of PLC technology.
Automatic dispensing machine with storage tank. Some domestic pharmaceutical dispenser products generally use the PLC technology, which leads to the equipment circuit is very complex, the machine appears very bulky, on-site assembly is also time-consuming and labor-consuming automation is not high.
In summary, the control device based on STM32 microcontroller technology to control the cartridge dispenser can effectively overcome the shortcomings and shortcomings of the traditional PLC control method, and reduce the overall cost of the cartridge dispenser. The process of controlling the dispensing device of the cartridge dispenser is as follows: the upper computer sends the corresponding 16-bit control signal to the STM32 microcontroller through the CAN bus. When the STM32 microcontroller receives these control signals, according to the communication protocol we write, it controls the corresponding ammunition block device to eject the cartridge. When the cartridge is sent out, a photoelectric detection circuit [6] is needed to detect whether the cartridge is sent out normally without being stuck. Therefore, the most important hardware design of cartridge dispenser includes three parts: the first part is the CAN bus transceiver control circuit, thermostatic element the second part is the cartridge dispenser ammunition block control device, and the third part is the photoelectric detection device. It can be seen from the above that the core of the control device of the cartridge dispenser is the CAN bus circuit. The CAN bus (controller local area network), namely the controller local area network (3-4), is the most widely used international field bus.
Initially, CAN bus was designed to communicate between Microcontrollers in the automobile environment, and form information exchange between automobile electronic control networks in the vehicle electronic control unit (ECU). It is a multi-master serial communication bus. The basic design specifications require high bit rate, high anti-interference, and can detect any errors. The longest transmission distance of the signal is 10 kilometers, but the data transmission rate can only be as low as 5 Kbps. CAN has a perfect communication protocol, which is automatically completed by hardware, so it reduces the difficulty of system development and shortens the development cycle, which can not be compared with RS-485 which only has electrical protocol. In the interface circuit of CAN bus, CAN-H and CAN-L are connected to the line. CAN-H can only be in high level or suspended state, and CAN-L can only be in low level or suspended state. This ensures that the interface circuit of CAN bus will not damage the node interface when the bus is in trouble like RS-485. Moreover, the CAN node has the function of automatically closing the output when the error is serious, so that the operation of other nodes on the bus will not be affected, so as to ensure that there will be no phenomenon in the network, because of the problems of individual nodes, the bus will be in a “deadlock” state. CAN controllers can work in multi-master mode, and each node in the network can be transformed into a host through a special arbitration mechanism (see CAN2.0 protocol standard). And CAN bus protocol replaces stack address coding with communication data coding, which makes each node receive the same data, thus greatly enhancing the real-time performance of data communication. CAN2.0, Extended Bit Mode, 800M Frequency, No Remote Frame. 00 00 AB CD is the address, the first two bits are 00, and the last two bits are variable. To execute the action mark. The corresponding action is performed at 01 and the communication test is taken at 02. To mark the position of the electromagnet: take the first electromagnet action when the value is 01, the second electromagnet action when the value is 02, and so on. For the power-on time marker, the value of 0.1 is 10 milliseconds for power-on, and the value of 10 is 100 milliseconds for power-on. : error action times flag bit: when the value is 05, the action will be 5 times, and when the value is other, the action will be 3 times. In order to detect enabling markers of pharmacodynamics for dispensing drugs, the pharmacodynamics participated in the detection when the value was 0.
1, and other values did not participate in the detection. Local address.
The successful marker of dispensing drugs. When the value was 0.1, the drug was successful, and when the value was 0.2, the drug failed. Location of dispensing drug. When the value is 0.1, the first box of medicines and the second box of medicines are given at 0.2, and so on. Aiming at the shortcomings of traditional dispensing machine which uses PLC control system to control dispensing device, such as high cost and complex equipment structure, this paper puts forward a method of using STM32 microcontroller. This method can effectively overcome the shortcomings of PLC control system by designing simple circuit diagram and using CAN bus communication to control dispensing device. At the same time, it can effectively improve the reliability and stability of the control system. However, there are still some deficiencies in this paper. The control system in this paper does not use an operating system with task management, resulting in no friendly human-computer interface. Thus, it brings inconvenience to the management and maintenance of the follow-up system and the iterative development.