With the comprehensive development of society and science and technology, programmable logic controller has been widely used in many fields. We will analyze it from the hardware circuit debugging of programmable logic controller, lower computer program debugging, upper computer program debugging and system on-line programmable logic controller debugging. This paper will discuss the debugging and testing of the programmable logic controller system as a starting point, and on this basis, make a thorough inquiry. The relevant contents are as follows. Circuit debugging is a very important part of circuit system design. If there are problems in circuit debugging, it will fundamentally affect the rationality of circuit design. Because the performance and data of differentiated electronic devices can not match each other, it is necessary to debug the circuit and deal with the faults accordingly to ensure the normal operation of the circuit system. The debugging of hardware circuit includes debugging of four kinds of interface circuits. In the debugging process, the level and current parameters of each interface should be tested, and the range of measurement should also be tested. In order to test whether the signal parameters of the correlated ports meet the requirements, it is necessary to write a specific MCU program to provide effective typical parameters for each port. For example, by setting the parameters of pulse width modulation, the analog output port can transmit four to twenty milliamperes of current signals, and at the same time, it can be measured by multimeter. For analog output port, when the minimum parameters and extreme values are set, there will be a slight change in the range of 4 to 20 mA, that is to say, it meets the design requirements; when the input of AI port is set to 4 to 20 mA, the full range conversion can be achieved by single instrument A/D conversion. Therefore, the design of hardware circuit meets the design standard. The meaning of Lower Machine program is to receive the field bus communication protocol commands transmitted by Upper Computer and to respond frames to Upper Computer by executing corresponding functions. The debugging of MCU program should focus on the debugging of field bus communication protocol.
The debugging mode adopted in this study is: debugging through simulation circuit model first, and debugging through actual circuit board on this basis. Lower machine circuit model is built by EDA tool software. Because the EDA tool software does not contain the model of STC series MCU, AT89C51 can be chosen to reflect the state of defense command through 16 light emitting diodes, and DI state can be set by 74HC165 input at high/low level, while the number can be set directly in the program for AI and analog output. This method can effectively prevent. Program changes due to different models.
In order to debug the serial port of virtual circuit, it is necessary to simulate a pair of serial ports by increasing the number of serial ports. The corresponding serial port information can be seen in the operation interface. ModScan program is the main station of Fieldbus protocol. It can debug Lower Machine communication program. See Figure 1.
It executes function code 2: read DI status. The parameters read are reflected in the dialog box. After the above debugging, the function of Lower Machine program has been fully verified. On this basis, program burning software is downloaded through MCU, and the program is transmitted to MCU. ModScan is used to further debug the program, and then complete Lower Machine program is obtained.
Upper computer link communication realizes command and response exchange between Upper computer and programmable logic controller. Command and response signals are exchanged in sequence. Modules with frame-sending weight can transmit frames at any given time. In the process of frame transmission, the right to send frames is exchanged between Upper Computer and programmable logic control. When the terminator and delimiter are received, the sending frame weight is transferred from the sending module to the receiving module. At the same time, in the link communication of Upper Computer, Upper Computer first has the right to send frames.
On this basis, the communication is initialized, and the programmable logic controller automatically transmits a response signal. Programmable Logic Controller (PLC) achieves the initialization of serial communication interface by setting up individual modules in DM area of data memory, and then chooses Upper Computer link communication mode.
Optional communication protocol is 9600 baud, one start bit, seven data bits, one stop bit and even check. Select the specific serial port of Upper Computer as the communication terminal with programmable logic controller. Based on the Slave function of the field bus protocol, when debugging the program of the host computer, the virtual circuit model and the virtual serial port are adopted directly. After many debugging and adjustment, the Upper Computer program can also complete the function of the main station of the field bus protocol. This design chooses SIEMENS AG FWB S7-200 programmable logic controller and system for on-line debugging. The programmable logic controller adopted is CPU244 DC/DC/DC, including ten 24-volt digital output ports and no analog input/output ports, so only digital input/output ports can be debugged. 。 Firstly, the hardware circuit is connected. At the same time, the program for debugging is input into the programmable logic controller.
The single chip circuit board is connected with the serial port of the computer, and the Upper Computer software is run on the computer. See Figure 2. Firstly, select COM1 serial port, and set Baud rate to 96, parity check None, remote TT