“There are many applications of pic microcontrollers, and many control systems in life are designed based on pic microcontrollers. For the pic microcontroller, the editor has brought many introductions. In this article, we will bring you examples of pic microcontrollers to enhance your understanding of pic microcontrollers.
“
There are many applications of pic microcontrollers, and many control systems in life are designed based on pic microcontrollers. For the pic microcontroller, the editor has brought many introductions. In this article, we will bring you examples of pic microcontrollers to enhance your understanding of pic microcontrollers.
1 Introduction
For the plastic bottle-making process, the plastic is heated in a molten state, and is formed into a tube embryo by high-pressure injection. One of its process features is: the plastic in the molten state flows regularly; after it becomes a tube embryo, it will be in contact with the outside air for about 2 seconds, and the product quality is inevitably affected by the ambient temperature. The bottle-making process requires constant temperature at different temperatures in different bottle-making processes, and its temperature control is one of the key technologies in bottle-making. At present, the temperature control device of this kind of equipment usually adopts a single-loop general-purpose temperature control instrument, and the temperature control cannot be directly related to the technological process, so that the temperature control cannot reach the optimal state, and it is affected by the ambient temperature and must follow the ambient temperature. Changes to adjust the temperature control parameters, otherwise the product quality will be affected. On the other hand, the price of single-loop general-purpose temperature control instruments is also relatively high, and it is often difficult to achieve ideal control effects by using classical control methods such as linear model and PID control, while fuzzy control is used, which has an object-independent mathematical model , the robustness is strong, and the algorithm is simple and easy to implement. Therefore, we have developed a low-cost, high-performance, multi-loop temperature control device that is controlled by PIC16F877 single-chip microcomputer, which is directly related to the process and is not affected by ambient temperature.
2. System hardware design
2.1 Composition of the hardware system
The system is designed as 8 temperature detection loops, each loop converts the weak temperature signal generated by the thermocouple into a standard voltage signal of 0~5V through the temperature transmission unit, and sends it to the PIC microcontroller for A/D conversion. As the input of fuzzy control, the PIC microcontroller calculates the control output quantity through fuzzy control according to the input data, converts it into the duty cycle of the PWM signal, and outputs the corresponding high and low levels of the RD port pin to control the action of the solid state relay to realize the control of the system temperature. control, and control SED1335 through C8051F020 single-chip microcomputer, so as to control the liquid crystal Display to display the results. For the hardware configuration of the multi-loop temperature detection system, the design adopts a folded open structure to ensure the flexibility and low cost of the temperature control loop configuration. The hardware block diagram of the system is shown in Figure 1. The whole system consists of four parts: data acquisition module, main control module, control quantity output module and man-machine communication module.
2.2 Modular design of hardware
2.2.1 Data acquisition module
The 8-channel temperature detection circuit designed in this design uses thermocouples, which are widely used in the modern industrial production process, to measure the temperature of the temperature sensitive elements. For the detection and control effect, multi-point multi-loop detection and a very practical cold junction temperature compensation circuit are used in the whole bottle making process, so that the output is close to linearization. Basically a single-valued function relationship. After the thermocouple is compensated for the temperature of the cold junction, the output is a very weak analog signal, which is suitable for the A/D converter integrated by the PIC16F877 microcontroller to convert it into a digital signal that the microcontroller can recognize and convert it into a corresponding temperature value after amplification.
2.2.2 Main Control Module
The control core of this system is PIC microcontroller. PIC microcontroller is a new type of 8-bit microcontroller using CMOS technology that has appeared in recent years. The selected PIC16F877 microcontroller integrates 8 channels of 10-bit A/D converters, and has a built-in 8k × 14-bit Flash program memory, which can be Modify the program many times to facilitate system upgrades. The temperature control device with PIC16F877 as the core does not need to expand the I/O chip and A/D converter, which greatly improves the reliability and anti-interference of the system, and realizes the communication with other microcontrollers through the communication port, so as to obtain the technological process. The data parameters make the temperature control directly related to the process, and improve the accuracy of temperature control and product quality.The use of fuzzy control can avoid the control object
The inaccuracy of the transfer function and the error caused by nonlinearity improve the accuracy of temperature control. Because the system has the characteristics of large inertia (the process of heat conduction and heat balance is required), in order to improve the rapidity of the system and the accuracy of fuzzy control, the specific control algorithm adopts the method of segmented control, that is, the temperature characteristics of the controlled object have a On the basis of certain experience and knowledge and rough experiments, the temperature control process is divided into the front stage and the back stage to be processed respectively, which will not be repeated here. As the control core, the PIC microcontroller is connected with other modules, processes various data, and sends out various control signals.
2.2.3 Control output module
The output module of this design is to output the decision signal of the main control module through the RD port of the PIC16F877 microcontroller to control the on-off of the corresponding solid state relay (SSR for short) to achieve the purpose of controlling the heater. The selection of solid state relays instead of ordinary relays is closely related to its good characteristics, and its price is not expensive. It is a non-contact switching device with relay characteristics that uses semiconductor devices instead of traditional point contacts as switching devices. Single-phase SSR is a four-terminal active device, in which two input control terminals, two output terminals, and photoelectricity between the input and output. Isolation, after adding a DC or pulse signal to the input terminal to a certain current value, the output terminal can be converted from an off state to an on state. Specifically, the signal sampled at a certain time is processed by A/D and the control output is calculated by fuzzy control, which is converted into the duty cycle of the PWM signal, and the corresponding high and low levels are output from the RD pin to control the solid state. For the relay, if the measured temperature value is smaller than the given temperature value, the solid state relay will be turned into an on state for heating and heating, otherwise, it will turn into an off state to suspend heating.
2.2.4 Human-machine communication module
In a temperature detection system, a well-designed man-machine interface is often required. Designers can obtain necessary information in the man-machine exchange interface, and at the same time, they should visually display the purpose they want to achieve (that is, to control the temperature at the set temperature value). To this end, we will detect the obtained data and set the temperature value to the C8051F020 single-chip microcomputer transmission and through the dot matrix liquid crystal display (LCD) display.
To make PIC16F877 one-chip computer and C8051F020 one-chip computer realize data transmission, must establish accurate communication between them. Because they are different when selecting crystal oscillators, when calculating the baud rate of asynchronous serial communication in the system, due to the existence of different baud rate errors, communication often fails. Research shows that the application of software interpolation, adjusting the baud rate of the serial port, and reducing the baud rate error can ensure the accuracy of communication; the liquid crystal display technology used in this design has been widely used in real life. Liquid crystal display module plays an increasingly important role in scientific research, production and product design due to its advantages of low power consumption, small size, rich display content, modularity and simple interface circuit. We choose SED1335 as LCD controller. According to the performance characteristics of C8051F020 MCU and SED1335, the SED1335 is directly controlled through the I/O port of C8051F020 MCU, so as to achieve the purpose of controlling the liquid crystal display to display the detection data; for the maximum, minimum and final temperature values that the system allows to measure and control, as well as page turning, The jump (floating cursor) function is realized by the operation of the keyboard.
3. System software design
The software design of this system adopts modular program design, which consists of main program, initialization subprogram, display subprogram, key processing subprogram, AD conversion subprogram and other modules. The main program mainly includes key scanning, display and processing subroutines. According to Shannon’s theorem, the sampling is periodically timed. The AD conversion is started at the end of the delay, and is controlled by fuzzy control after the conversion.
4. Conclusion
The above is the relevant content of “pic single-chip microcomputer” brought by this editor. Through this article, I hope everyone has a certain understanding of how to use pic single-chip microcomputer to design a multi-loop temperature control system.
The Links: LM150X05-A2 CM600HA-28H