DP is currently the most widely used bus system in Europe and the world. It is a high-speed, low-cost bus for device-level control systems and distributed I/O communication. It is easy to install, has a variety of topologies, is easy to implement redundancy, real-time communication is reliable, and its functions are perfect. Its excellent performance makes it suitable for various industrial automation fields.
The Profibus protocol conforms to the open system reference model of ISO/OSI. For the Profibus-DP implemented in this paper, the first layer is the physical layer, which can be implemented by RS-485 or optical fiber. The second layer is the data link layer. The Profibus access protocol of this layer is the same for DP, PA, and FMS, which makes the DP/PA/FMS network area easier to combine. The third to seventh layers are not described. Such a protocol structure facilitates the rapid implementation of data transmission. There can be up to 32 stations per segment on the DP bus. When there are more than 32 stations on the bus, you must use a repeater to connect the branches of each bus. There is a bus terminating resistor at the beginning and the end of each segment. In order to ensure that the operation does not occur in error, the two bus terminating resistors must always have power, and the repeater can be connected to up to 127 nodes.
1, system overview
The block diagram of the whole system is shown in Figure 1. It consists of one master station and two slave stations. The main station is realized by Siemens PLC, and the slave station consists of a touch screen and a variable frequency system Profibus slave station.
Figure 1 system block diagram
The DSP 2812 is the core processor of the variable frequency control system, and it exchanges data with the on-site DSP through the dual port RAM. The live DSP is connected via a Profibus bus bridge to the Profibus network. In this way, the DSP can seamlessly exchange data with the Profibus network on the spot: through the network, the instructions issued by the PLC and the instructions issued by the debugging personnel or the operator through the touch screen can be read; on the other hand, the working state of the frequency conversion system can be read. Signals such as current, voltage, speed reference, actual speed feedback, fault code, etc. are transmitted to the PLC and touch screen through the Prifibus network. The touch screen is displayed in the form of status indicator, actual data, curve, etc., and the PLC is in real time. Analyze and give the appropriate instructions.
2, system hardware implementation
The main station is realized by Siemens 315-2DP PLC, and the touch screen adopts Siemens TP270 for data display and input. The hardware of these two parts will not be described in detail. For details, please refer to the relevant product manual.
The Profibus bus bridge is an important part of the system. It is a product developed for the Profibus-DP communication function. The hardware schematic is shown in Figure 2. It itself contains an interface CPU that provides two ports for the external hardware of the bus bridge: a serial communication interface TXD and RXD, and an A and B connected to the Profibus network. In this system, the interface CPU mainly exchanges data with the on-site DSP, and connects SCIRXDB and SCITXDB of the live DSP serial port B through TXD and RXD respectively. The on-site DSP reads the data required in the dual-port RAM and transmits it to the interface CPU through serial communication. The data transmitted by the interface CPU and the Siemens Profibus communication protocol chip SPC3 are exchanged. In this way, SPC3 sends the data obtained by communication in the form of Profibus-DP, and converts the standard interface into the bus, and the data transmission in the opposite direction is similar. The frequency conversion system will then become a node on the Profibus network. This allows us to build a Profibus-DP slave with a microcontroller without the need to fully study the Profibus data link layer access protocol, and complete the Profibus development of the inverter system in a short time.
Figure 2 Profibus bus bridge schematic
In the figure, the Profibus bus uses a dedicated Profibus-DP plug with a terminating resistor and a Profibus shielded twisted pair cable. Since the Profibus bus bridge and the touch screen act as two terminals on the Profibus bus, the two terminating resistors are turned ON, in the middle. The termination resistance of the node PLC is turned OFF.
3, software implementation
The software part firstly initializes the Profibus bus bridge by the on-site DSP. Immediately after the initialization, it enters the infinite loop of the Profibus bus bridge and the field DSP data exchange, and then carries on the data communication between the DSP 2812 and the PLC and the touch screen.
Figure 3 is a flow chart of the Profibus bus bridge software design. Since the asynchronous serial port baud rate of the Profibus bus bridge can automatically adapt to the five baud rates of the access device (9.6, 19.2, 38.4, 57.4, 115.2 kb/s), when the Profibus bus bridge is initialized, the on-site DSP must be directed to Profibus. The bus bridge continuously sends 5 initialization messages to test the baud rate of the access device, as shown in the first 5 data shown in the next line of Figure 5. The format of the initialization message is formed according to the provisions of the Profibus bus bridge, followed by the station number, ID number, I/O configuration data length, I/O configuration data, received data length, transmission data length, user parameter length, and baud. Rate test data and checksum. The Profibus bus bridge analyzes the 5 initial initialization messages sent by the on-site DSP, and responds to the on-site DSP according to the received message. The response message mainly includes the following aspects: the tested baud rate number. Initialize the message error number and initialization success flag (or error flag). As shown in the first message in the upper line of Figure 5. The on-site DSP also analyzes the response message after receiving the message answered by the Profibus bus bridge. If the response message indicates that the initialization is successful, it immediately transfers to the data exchange. If it is unsuccessful, analyze the cause of the initialization failure and display the corresponding error code, which can be modified by the corresponding error code and finally initialized.
Figure 3 Profibus bus bridge software flow chart
After the Profibus bus bridge is successfully initialized, it enters the data exchange state immediately, as shown in Figure 5. After receiving the data of the interface DSP, the on-site DSP writes the data to the designated storage area in the dual port RAM, and the DSP 2812 reads the corresponding data from the storage area for processing. For the data to be displayed on the site, the DSP 2812 writes to the corresponding storage area of ​​the dual-port RAM, and then the data of the field DSP readout storage area is handed over to the Profibus bus bridge for processing, and finally displayed by the touch screen, as shown in FIG. After entering the data exchange state, the parameters can be modified and handed to the controller in real time. At the same time, the parameters set by the controller can be displayed in real time, which greatly facilitates the debugging work at the production site.
Figure 4 data exchange software flow chart
Figure 5 initialization and data exchange
For the touch screen, we use Siemens' configuration software Protool to configure. The design interface consists of three parts: main interface, electricity and parameter interface and debugging interface. The main interface is used to set the working state of the frequency conversion system, such as current, voltage, speed reference, actual speed feedback, fault code and other signals; the motor parameter interface is used to set the relevant parameters of the motor, and the debugging interface is input during debugging. Related parameters, such as current, voltage regulator related parameters. Figure 6 is a diagram of the main interface configured with Protool.
Figure 6 main interface
4 Conclusion
Through field application, the Profibus communication scheme based on single-chip inverter system, the on-site DSP is responsible for collecting signals from the scene and transmitting the master station command to the field execution equipment. The slave station and the Ximen CPU315-2DP master station can cooperate to reduce the difficulty of system debugging and wiring. Shorten the development cycle, which is conducive to improving the digitization of the product, and is also convenient for convenient connection with other devices with PROFIBUS-DP interface, improving the versatility of the product.
Jinhu Weibao Trading Co., Ltd , https://www.weibaoxd.com