Communication between PLC and master/slave station based on PROFIBUS-DP bus technology
2026-04-06 07:21:07··#1
1. Introduction Currently, the widely used DCS systems in industrial control are gradually revealing many shortcomings in practical applications. Industrial production processes often employ one-to-one connections, using analog voltage and current signals for measurement and control, or utilize self-contained distributed systems, making it difficult to achieve information exchange between devices and between the system and the outside world. This turns the automation system into an "information island," and these shortcomings cannot be fundamentally solved by DCS. Therefore, it is necessary to consider a completely new control system to address the problems existing in current DCS systems. Fieldbus control systems, or FCS (Field Bus Control System), are the best choice. 2. Advantages of Fieldbus Fieldbus connects intelligent field devices and automation systems through a "bus," enabling interoperability. Its emergence has promoted the digitization and networking of field devices and greatly enhanced the functions of field control, making process control systems open and comprehensive control systems with integrated capabilities of measurement, control, and process diagnostics. Fieldbus control systems are open, digital, and multi-point communication control systems based on a low-level control network. Compared with traditional DCS systems, fieldbus systems have the following six main characteristics: (1) digital signal transmission; (2) unified and open standards; (3) thoroughly decentralized control functions; (4) high system reliability and good maintainability; (5) adaptability to the field environment; and (6) reduced system and engineering costs. The proliferation of international fieldbus standards demonstrates the advanced nature of this technology and its promising future. In addition, fieldbus has the following advantages: First, a single communication line connects N control devices or instruments, reducing installation costs, shortening project timelines, facilitating maintenance, ensuring high reliability, strong anti-interference capabilities, and high precision; second, good interchangeability and interoperability, allowing interconnection of instruments from different manufacturers; third, decentralized control, with field control instruments possessing not only detection functions but also computation and control functions, resulting in a thoroughly decentralized control loop. 3. PLC and Master Station A PLC is a new type of industrial automatic control device that integrates automation technology, computer technology, and communication technology, with a microprocessor as its core. It can transform traditional mechanical products into a new generation of mechatronic products and is also suitable for production process control. With its excellent reliability, anti-interference ability, and programmability, it is now widely used in the automatic control of various production machinery and processes. This article mainly introduces how to use the PROFIBUS-DP adapter card CP5611 to complete the communication between a Class I master PLC and a Class II master PC, as well as the connection between the PLC and slave stations. A PROFIBUS-connected system consists of a master station and slave stations. The master station can control the bus; when the master station gains control of the bus, it can actively send information. Master stations can be further divided into Class I and Class II master stations. A Class I master station can determine the data communication of the bus; when the master station gains control of the bus, it can actively send information without external requests. A Class II master station includes operator workstations, programmers, operator interfaces, etc., which complete data reading and writing, system configuration, fault diagnosis, etc., for each station. Slave stations are simple peripheral devices, typically sensors, actuators, and transmitters. They lack bus control and only respond to received information or send back relevant information to the master station when requested. Typical slave stations include input/output devices, valves, actuators, and measurement transmitters. Master stations communicate using a token ring mechanism, while master-slave communication occurs between them. In this paper, the first type of master station refers to a PLC, and the second type is a general-purpose PC. Their communication principle is shown in Figure 1. The PROFIBUS protocol is based on the OSI/ISO network reference model, using only the first physical layer, the second data link layer, and the user layer; layers three through seven are not used. If a PLC is chosen as a first-type master station, there are two scenarios: one is a CPU with a built-in PROFIBUS interface (this type of CPU typically has one PROFIBUS-DP and one MPI interface); the other is a PROFIBUS communication processor (the CPU does not have a PROFIBUS interface and requires a PROFIBUS communication processor module). A PC with a PROFIBUS network card can be used as a master station. These network cards have PROFIBUS/DP/PA/FMS interfaces. The software package used with the network card is selected, and the software function determines whether the PC is a Class I or Class II master station. In this paper, the CP5611 network card is selected and the Step7 software package is selected. Therefore, the PC is only used as a Class II master station for programming and monitoring. The CP5611 itself does not have a microprocessor. It is a short PCI card that can run a variety of software packages. The 9-pin D-type connector can be used as a PROFIBUS-DP and MPI interface. It has the following functions: (1) DP function: The PG/PC becomes a PROFIBUS-DP Class I master station and can connect to DP distributed I/O devices. The master station has DP protocol functions such as initialization, database management, fault diagnosis, data transmission and control. (2) S7 FUNCTION: Enables communication between SIMATIC S7 devices. Users can use the PG/PC to program SIMATIC S7/S5. (3) Supports SEND/RECEIVE function. (4) PG FUNCTION uses STEP7 PG/PC to support the MPI interface. 4 PLC and Slave 4.1 Information Content Data transmission between the PLC and the slave is initiated by a serial communication request. The slave that issues the request is called the source, and the slave that receives the request is called the target. The serial communication request is set in the user program and contains the following information: (1) Identifier of the target or slave receiving the communication request; (2) Direction of data transmission (data can be transmitted bidirectionally); (3) Target address of data transmission; (4) Source address of data transmission; (5) Quantity of data to be transmitted. 4.2 Format Requirements After the user program of the source slave initiates the communication request, the above communication request information is transmitted to the communication control. The communication control converts this information into an appropriate format suitable for transmission via the serial line interface. This format has the following requirements: (1) Whether to encode or decode the required information according to the standard information code; (2) Whether to assemble or disassemble the communication request information and the transmitted data text according to the communication protocol; (3) Method for checking errors that occur during transmission. Once a communication request is initiated and the data has been correctly formatted, the serial interface will send the data out via the serial communication line. In Figure 2, the host computer establishes communication with the remote slave station by initiating a communication request that begins with a query sequence. To maintain this communication, the requested slave station must acknowledge the query at an appropriate time. After communication is established, the host computer sends a header language necessary for transmitting a data file block to the PLC. Once the PLC receives this header information, the data file can be transferred between the host computer and the PLC. When the PLC receives the data information, it processes it in the reverse order of data transmission. First, it converts the data from serial to parallel mode, then extracts characters from the protocol and processes them in a specific way. Finally, the data information is transferred from one memory of the PLC to another memory via the user program. 5. Conclusion: Communication between the PLC and field instruments completes the function of the DP network, enabling decentralized control, reducing system operational risks, and will play an indispensable role in field applications. The communication between the PLC and the Class II master station in the DP network can not only meet the functions of debugging and monitoring program operation, but also allow the development of a human-machine interface on the Class II master station, making it easier for staff to monitor the working status of field instruments more intuitively and conveniently.