Share this

Research on Master-Slave Communication Based on Profibus Protocol

2026-04-06 06:57:56 · · #1
Abstract: This paper introduces the application of the Siemens CP342-5 module in the rotary kiln monitoring system of a cement plant. It presents the implementation method of communication between the CP342-5 module and P+F Encoder absolute encoders based on the PROFIBUS protocol. The paper also analyzes the drawbacks of traditional distributed control systems based on PC, PLC, and DCS products, and the advantages of fieldbus-based automated monitoring and information integration systems. Finally, it provides the implementation program for master-slave communication between the Siemens CP342-5 module and multiple intelligent encoders (P+F Encoders). Keywords: CP342-5; Pepperl+Fuchs encoder; Profibus; Programmable Logic Controller; Master/Slave Communication Abstract: This paper introduces the application of the CP342-5 encoder in the rotary kiln supervisory control system of the Ju-long cement plant. A communication method between the Siemens CP342-5 and the P+F absolute encoder is provided. An analysis of the distributed automation monitoring and information integration system based on PC, PLC, and DCS products is also presented. A communication program between the Siemens CP342-5 and multi-intelligence P+F encoders using the Profibus Protocol is then established. Keywords: CP342-5, P+F Encoder, Profibus, PLC, Master/Slave Communication 0 Introduction In the rotary kiln monitoring system of the Ju-long cement plant, a high-performance Siemens S7-300 PLC is used. To read the encoder parameters into the Siemens PLC, a Siemens... The company's PROFIBUS communication processor CP342-5 integrates a DP port to read binary data from the encoder via a PROFIBUS-DP bus network. The encoders are Pepperl+Fuchs absolute rotary encoders from Germany, all of which provide PROFIBUS-DP communication interfaces and communicate in a master-slave manner using the PROFIBUS protocol. A key characteristic of traditional field-level and workshop-level automation monitoring and information integration systems is the one-to-one connection between field devices and controllers (one I/O point to one control point on the device), a so-called I/O wiring method, transmitting 4-20mA (analog information) or 24VDC (digital information) signals. This results in weak information integration capabilities, a closed system, poor integrability, difficulty in guaranteeing reliability, and low maintainability. PROFIBUS, on the other hand, is a widely adopted and currently the world's most successful open fieldbus, allowing all automation devices (PLCs, intelligent instruments with communication interfaces, sensors, and actuators, etc.) to be connected via a single communication cable, exchanging data and communicating with each other. PROFIBUS fieldbus replaces 4-20mA/24VDC signals with digital communication to perform functions such as field device control, monitoring, and remote parameterization. Intelligent encoders are among the most commonly used intelligent instruments in industrial control. They primarily target specific parameters (such as liquid level, stroke, and height) and employ advanced control algorithms (such as FAST technology) to achieve precise control of the controlled parameters. They are characterized by high professionalism, high intelligence, advanced control algorithms, and ease of use. Programmable Logic Controllers (PLCs) are widely used in industrial control due to their reliable operation, high integration, and strong scalability. Various PLC manufacturers provide a variety of communication modules, such as industrial Ethernet modules, PROFIBUS DP fieldbus modules, AS-I modules, and point-to-point serial communication modules. Therefore, data from intelligent encoders can be read using the PLC's communication modules and then connected to the enterprise SCADA HMI system via the PLC's industrial Ethernet or fieldbus modules. [1] 1 Communication Structure and Communication Protocol 1.1 Communication Structure In the cement plant kiln monitoring system, CP342-5 modules and 5 Pepperl+Fuchs encoders are used for communication, which is divided into three parts in space: the kiln tail, the kiln middle, and the kiln head. The distance between the kiln tail and the kiln head is about 50 meters. In terms of hardware connection, PROFIBUS shielded twisted pair cable is used for communication. In terms of software, PROFIBUS-DP fieldbus communication network is used to complete the communication task with the fewest signal lines. In this automated monitoring system, it is required to read five Pepperl+Fuchs Absolute Rotary Encoder PVM 58 units into the PLC via the CP342-5 communication module. The network structure is shown in Figure 1. The parameter settings for the CP342-5 module and the P+F Absolute Encoder PVM 58 are given below, and the PROFIBUS-DP protocol used for communication between the communication processor CP342-5 and the Pepperl+Fuchs encoders is described in detail. 1.2 Communication Processor - CP342-5 The Siemens CP342-5 is a PROFIBUS-based communication module that provides a low-cost solution for serial communication. It can be used in S7-300, acting as both a PROFIBUS-DP master and slave, but not simultaneously. Furthermore, it can only be used on the central rack of the S7-300 and cannot be used on distributed slave units. The CP342-5, acting as a DP master, differs from slaves in that its communication interface area is not the I/O and Q-interfaces, but a virtual communication area. It requires calling FC1 and FC2 to establish the interface. Parameters can be set in the STEP 7 hardware configuration process, mainly including communication protocol, communication mode, interface method, address, and baud rate. For communication with the Pepperl+Fuchs P+F Rotary Encoder PVM 58, this design can set it to: a) Communication protocol: PROFIBUS-DP b) Communication mode: DP Master c) Interface method: PROFIBUS d) Address and baud rate: 2, 19.2Kbps e) The rest are set to default. 1.3 Communication Protocol - PROFIBUS-DP PROFIBUS-DP (Decentralized Periphery) is a high-speed, low-cost communication protocol used for communication between device-level control systems and distributed I/O. Due to the openness of PROFIBUS-DP, it can connect standard components from different manufacturers. Using PROFIBUS-DP can replace 24VDC or 4-20mA signal transmission. It boasts advantages such as energy saving, low cost, convenient and simple configuration, high flexibility in production, reliable and accurate diagnostic data, and reliable digital transmission technology. The PROFIBUS-DP protocol structure is based on the ISO 7498 international standard, using the Open System Interconnection (OSI) model as a reference. PROFIBUS-DP defines layers one and two, and the user interface. Layers three through seven are not described. The user interface specifies the application functions that users, the system, and different devices can access, and details the device behavior of various PROFIBUS-DP devices. A typical DP configuration can be a single-master or multi-master structure. Token transmission is used between masters, and master-slave cyclic transmission occurs between masters and slaves, with a maximum of 126 stations on the bus. In master-slave communication, the master (PLC, CP, or process control system) and slave (distributed field devices, such as I/O valves, encoders, transmitters, and analyzers) exchange data rapidly in a cyclic manner. The master sends a request message, and the slave receives it and returns a response message. When the network is used for small-scale, fast cyclic communication such as binary input/output and analog input/output, it is advisable to configure the network as a PROFIBUS DP network, which has a maximum data transfer rate of 12 Mbit/s. 1.4 P+F Absolute Rotary Encoder Communication Parameter Settings 1.4.1 Installing the GSD File The GSD file is an electronic device database file, a readable ASCII file. PROFIBUS products from different manufacturers are integrated together, and the manufacturers must provide the functional parameters of these products in the form of GSD files, such as the number of I/O points, diagnostic information, transmission rate, and time monitoring. In Step 7's SIMATIC Manager, open the hardware configuration tool HW Config. After installing the GSD, the newly installed P+F Rotary Encoder will appear in the hardware directory on the right: PROFIBUS DP → Additional Field Devices → Encoders → ENCODER. Its data transmission principle is shown in Figure 2. [align=center]Figure 2 Data Transmission Principle Diagram[/align] 1.4.2 Configure Communication Parameters In the Step 7 hardware configuration window, double-click the P+F Rotary Encoder icon to open the encoder (DP Slave) parameter setting window, as shown in Figure 3. Based on the author's actual project, the parameters are set in this window: [align=center]Figure 3 Encoder Parameter Setting Window[/align] a. Code Sequence: Counting direction, CW (clockwise rotation, code increments), CCW (counterclockwise rotation, code increments); b. Scaling function control: Only when set to Enable will the settings in c, d, and e below take effect; c. Measuring units per revolution: 8192; d. Total measuring range (units) hi: 512; e. Total measuring range (units) lo: 0; f. Other parameters use default values. Note: 1. From c, we can calculate that the encoder generates (=8192) binary codes per revolution, i.e., the single-revolution precision is 13 bits. 2. From d and e, we can calculate that the encoder can rotate a maximum of (=512×65536+0) revolutions, i.e., the multi-revolution precision is 12 bits. 2 Software Implementation Method 2.1 Data Stream Exchange Mechanism The data stream exchange mechanism between the CP342-5 and the S7-300 CPU with integrated DP port and the DP slave station is different. The S7-300 CPU with integrated DP port can access the DP slave station as if it were its own I/O module, without requiring special programming by the user. Although the input/output area provided by the intelligent slave station to the master station is not the actual I/O area used by the I/O module, after simple configuration, the data exchange between the master and slave stations is also automatic and does not require special programming. For data exchange between the CP342-5 and the DP slave device, FC1 (DP_SEND) and FC2 (DP_RCV) must be called to access the slave address; otherwise, the PROFIBUS status light "BUSF" on the CP342-5 will flash. FC1 (DP_SEND) and FC2 (DP_RCV) are function blocks in the SIMATIC_NET_CP standard library. After installing NCM S7, this function library will appear in the instruction tree on the left side of the Step 7 editor. Using the CP342-5 as a DP master differs from using it as a slave; its corresponding communication interface area is not the I and Q areas, but a virtual communication area. FC1 and FC2 need to be called to establish this interface area. A virtual communication area needs to be defined for each P+F Rotary Encoder. The virtual communication area can be a bit storage area (M area) or a data block storage area (DB area). 2.2 Establishing the Virtual Communication Area When processing each rotary encoder, a virtual communication area must be established; this is the core issue of communication between the CP342-5 and the P+F Rotary Encoder. When the master station (CP342-5) and slave station (P+F Encoder) communicate, the address of each encoder must first be set to match the configured PROFIBUS address; then, a virtual communication area is established. Afterward, communication between the CP342-5 and the P+F Rotary Encoder only occurs between the CPU and the virtual communication area, without needing to consider the encoder address. Based on the author's actual engineering practice, the virtual communication area shown in Figure 4 was established. [align=center] Figure 4 Virtual Communication Area[/align] 2.3 Implementation of Master-Slave Communication Program The preset function is executed to calibrate the P+F Encoder zero point to the system's mechanical zero point. This is achieved by setting the highest bit of the double-word instruction output to the P+F Rotary Encoder to 1. The double word returned by the P+F Rotary Encoder is then the actual code value. [align=center] Figure 5[/align] The program instructions are shown in Figure 5. For the P+F Rotary Encoder acting as a slave station, FC1 (DP_SEND) is called when executing the preset function to fill the output virtual communication area with the command to be sent; FC2 (DP_RCV) is called when executing the read function to read the binary code in the P+F Rotary Encoder into the input virtual communication area. 3. Conclusion Since its renovation was completed last year, the No. 1 production line of Julong Cement Plant has been fully operational. The master-slave communication between the Pepperl+Fuchs absolute encoder and the Siemens CP342-5 has been excellent, effectively improving production efficiency. Practice has proven that this method is worth promoting. In the field of industrial measurement, using the professional Siemens CP342-5 as the master station and numerous PROFIBUS Slave devices as slave stations will undoubtedly achieve satisfactory results. The author's innovation: This paper presents a method for implementing communication between the CP342-5 module and the P+F Encoder absolute encoder based on the PROFIBUS protocol in the cement industry. References: [1] Liu Liangwen, Dong Ming, Zhao Hongzhou, et al. Performance analysis of PROFIBUS-DP fieldbus[J]. Microcomputer Information, 2006, 25: 46-48. [2] Li Hui, Zhang Hao, Bao Weihua. Application of PROFIBUS fieldbus technology in DCS system[J]. Manufacturing Automation, 2006, 11: 75-78. [3] Siemens Automation & Drive Company, Simatic Net NCM S7 for PROFIBUS/FMS Manual, 2001-12. [4] Memon QA and Rehman H., “Intelligent Approach towards Network Communications for Process Control,” in 11th Computers and Communications Symposium, pp: 681 – 686, 2006. [5] Eduardo Camponogara and Sarosh Talukdar, “Designing communication networks for distributed control agents”, European Journal of Operational Research [J], Volume 153, NO.3, pp 544-563, 2004.
Read next

Discussion on DCS Field Reliability Applications

1. Introduction The main function of a Distributed Control System (DCS) is to control, monitor, manage, and make decisio...

Articles 2026-02-22