Welcome to the Industrial Automation website!

NameDescriptionContent
XING-Automation
E-mail  
Password  
  
Forgot password?
  Register
当前位置:

Based on the S7-300/400 Ethernet module CP343-1 &CP443-1 Modbus TCP used in STEP7 Door (V6.0)

F: | Au:佚名 | DA:2023-11-21 | 1186 Br: | 🔊 点击朗读正文 ❚❚ | Share:

1 Overview of Modbus TCP communication

MODBUS TCP is a simple, vendor-neutral derivative of the MODBUS family of communication protocols for managing and controlling automation devices, and it obviously covers the purpose of MODBUS messages in the "Intranet" and "Internet" environments that use TCP/IP. The most common use of the protocol is for services such as PLCS and gateways connecting to other simple domain buses or I/O modules.

MODBUS TCP enables MODBUS_RTU to run on Ethernet. MODBUS TCP uses TCP/IP and Ethernet to transmit MODBUS packets between sites. MODBUS TCP combines Ethernet physical networking with the networking standard TCP/IP and data representation with MODBUS as the application protocol standard. MODBUS TCP communication packets are encapsulated in Ethernet TCP/IP packets. Unlike the traditional serial port mode, MODBUS TCP inserts a standard MODBUS message into the TCP message without the data checksum address.

1.1 Ethernet reference model for communication

The Modbus TCP transmission process uses Layer 5 of the TCP/IP Ethernet reference model:

Layer 1: The physical layer provides the physical interface of the device and is compatible with the commercially available media/network adapter.

The second layer: the data link layer, formats the signal to the source/destination hardware address data frame.

Layer 3: The network layer implements packets with 32-bit IP addresses.

The fourth layer: the transport layer, to achieve reliable connection, transmission, error checking, retransmission, port service, transmission scheduling.

Layer 5: Application layer, Modbus protocol packets.

1.2 Modbus TCP Data frame

Modbus data is transmitted over TCP/IP Ethernet and supports Ethernet II and 802.3 frame formats. The Modbus TCP data frame consists of three parts: packet header, function code and data. The Modbus Application Protocol (MBAP) packet header is divided into four domains. Total 7 bytes.

1.3 Port Number for Modbus TCP

(1) When PLC is used as Modbus server, Port 502 communication port is used according to default protocol, and any communication port is set in the Modus client program.

(2) When PLC is used as Modbus client, it is not necessary to set the local port number; If you want to specify a client port number, you are advised to start with 2000 to avoid conflicts with other communication protocols.

2 Overview of Modbus TCP communication on the S7-300/400 Ethernet module

This document applies to SIMATIC S7-300, S7-400 CPU with Ethernet module CP343-1 or CP443-1 software products. The instructions allow communication between S7-300, S7-400 systems with Ethernet modules CP343-1 or CP443-1 and devices that support the Modbus TCP protocol.

Data transmission is carried out according to the client-server principle. SIMATIC S7 can be used as a client or server during transfer.

2.1 Software and Hardware

When Modbus TCP commands are used in STEP7 software, the Modbus TCP CP instruction library needs to be installed before SIMATIC S7-300, S7-400 CPU with Ethernet module CP343-1 or CP443-1 can communicate with the communication partners that support Modbus TCP. As shown in Figure 2-1:

2.2 Modbus TCP CP V6.0 Software Option Package

When the software package is installed and integrated into Step7, you can find the block library, routines, and English manual in the corresponding directory of the Step7 installation file, as shown in the following figure. In the actual debugging process of the project, since the functions of the example program are relatively perfect, you can directly use the example program and modify the corresponding parameters according to the actual situation of the project. Can save a lot of parameter setting time.

3 Configure the Ethernet module as the Modbus TCP Server to communicate with the communication partner

The following uses the S7-300 single-site system and Modscan32 software as an example to describe how to configure the S7-300 single-site system as the Modbus TCP Server through the Ethernet module CP343-1 to communicate with Modscan32 as a Client.

3.1 Configuring Hardware

Create a new project (project name: MB_TCP_CP_V60) in STEP7.

3.2 Adding a TCP Connection

On the Hardware Configuration page, click "Configure Network" under Options to enter the network configuration page.

Next, select CPU, and in the table below, right-click and select "Insert New Connection" to add the TCP connection.

The communication partner is Unspecified and the connection type is TCP connection.

Select the local connection resource number (default ID=1) and PLC as the server. Note that "Active connection establishment" is not checked.

Click the "Addresses" page and set the local port number to 502.

3.3 Routine Description

Open the routine and copy all program Blocks (do not copy System data) from site SIMATIC 300 (Server) to the blocks of site SIMATIC 300 (1) of new project MB_TCP_CP_V60.

(1) Open OB1 and view the command "MODBUSCP"

The Modbus TCP command is invoked in the OB1 organizational block of the project,

The following are some pin descriptions (for other pin information, please see the instruction library manual) :

  • Metso A413005 Ver.04 Valmet CPU Module
  • Valmet M851207 AIU16 Card
  • Valmet BIU8 Binary Input Unit
  • VALMET 547070-2B CPU Printed Circuit Board Module
  • Valmet Automation A413325 Power Module
  • VALMET AUTOMATION A413135 AOU4 Module
  • VALMET ACU A413165 Model 9 Analog Controller
  • VALMET AUTOMATION A413511-02 Slot Rack with I/O Backplane
  • Valmet A413148 BIE 4 Rev 08 Board
  • Valmet ATB16-4 Controller Board
  • Neles Automation BOR82 A413292 Processor Module
  • Valmet A413015 NCU Module – Network Control Unit
  • Valmet AIU 16 Analog Input Unit – M8512071
  • Metso Valmet A413091 GDU Board
  • Valmet M851565 Damatic Main Keyboard
  • Metso A413082 CPU Module
  • Valmet A403037 GDC – Graphics Display Controller
  • Valmet A413076 FBC Board
  • Valmet A413015 NCU Module – Network Control Unit
  • Valmet A413082 CPU Module
  • VALMET AUTOMATION A413620 Fieldbus Repeater
  • Valmet Metso IOP341R Positioner Module
  • Metso A413082 Ver.04 CPU Module
  • Valmet Metso MCA FT250/10 10 Inch Sensor
  • Valmet N0542 ABMB Printed Circuit Board
  • Valmet A413000 Ver.07 CPU Module
  • Valmet A413061 Ver.05 DMU Module
  • Valmet M851241 M1 BCU Binary Input Module
  • Valmet Automation NCU A413015 Circuit Board
  • Valmet A413046 Ver.06 CPU Module
  • Valmet A651B001 Panel Mount Keyboard
  • Valmet IQ Scanner A418080R Basis Weight Detector Head
  • Metso Valmet A413370 ESU Ethernet SCSI Unit
  • Valmet A413340 FPU Power Supply Unit
  • Valmet SKF GE 400/600 Spherical Plain Bearing
  • Valmet SCU PCB Card 542844-7B – System Control Unit
  • Valmet A413075 FBU Fieldbus Controller Module
  • Valmet A413171 PIC Card Binary Output
  • Valmet A413002 Ver.05 CPU
  • Valmet ABMB PCB Card – Industrial Control Board
  • Valmet PMB 2R 542821-4A PCB Card
  • Metso Valmet A413001 CPU Module
  • Metso Valmet A413050 RSU 6 Serial Controller Unit
  • Valmet ABMB MT241 Input Mother Board
  • Valmet DAMATIC M851565 Keyboard
  • Valmet A413075 Ver05 FBC Board
  • VALMET K14891 FLEXI-U Operating Terminal
  • VALMET AUTOMATION MKB2 DAMATIC Keyboard
  • Valmet Metso Consistency Transmitter Smart Pulp M1 RL Blade
  • VALMET AUTOMATION A413230 ECU Module
  • Beckhoff EP9224-0037 - 4-Channel Power Distribution Box EtherCAT
  • Beckhoff CX2900-0026 - Solid State Flash Memory Card 20GB CFast
  • Beckhoff BK7500 - SERCOS Interface Fieldbus Bus Coupler Terminal
  • Beckhoff Ep2328-0002 - 4-Channel Input 4-Channel Output EtherCAT Box IP67
  • Beckhoff CX1020-0111 - Controller Kit Combo Interface Modules
  • B&R X20AI2237 - X20 System Analog Input Interface Module
  • Beckhoff CP2221-0010 - Multi-Touch Built-In Panel PC Touchscreen
  • Beckhoff CX1500-M310 - Fieldbus Master Interface Module 24V
  • Beckhoff CX2100-0904 - Power Charging Module Smart UPS Extension
  • Beckhoff CP3918-0000 - Multi-Touch Control Panel 18.5-Inch Monitor
  • Beckhoff CP2915-0000 - 15-Inch Multi-Touch Built-In Control Panel
  • Beckhoff CP7037-1027 - HMI Industrial Control Panel Built-In PC
  • Beckhoff EL3152 - 2-Channel Analog Input Terminal 4-20mA EtherCAT
  • Beckhoff CP6607-0000-0020 - 5.7-Inch Built-In Panel PC HMI Touch
  • Beckhoff EJ1809-0000 - 16-Channel Digital Input Pluggable Signal Level Terminal
  • Beckhoff AM8563-0N10-0000 - Synchronous Servo Motor
  • Beckhoff AX2006-S60600-520 - Compact Servo Drive Inverter
  • Beckhoff AM8053-0K20-0000 - Servo Motor with Planetary Gearbox AG3210
  • Beckhoff AM8042-0FH1-0000 - Synchronous Servo Motor
  • Rexroth R911338600 - IndraControl V HMI Terminal Beckhoff PCI Card FC9002
  • Beckhoff AX5125-0000 - 3 Phase Industrial Servo Drive 1000Hz
  • Beckhoff EP2328-0002 - 4-Channel Digital Input 4-Channel Output EtherCAT Box
  • B&R 7CP476-02 - System 2005 RTD CPU Module 3IF681.86 Interface
  • Beckhoff AX8620-0000-0000 - Power Supply Module Axis Drive System
  • Beckhoff CX1010-0111 - PLC Module CPU Controller 24V
  • Beckhoff AM8043-0H10-0000 - Synchronous Servo Motor
  • Beckhoff C6240-1009 - Control Cabinet Industrial PC Mainframe
  • Beckhoff BX8000-0000 - Bus Terminal Controller HW 4.4 Standalone
  • Beckhoff CP7721-1089-0020 - 12.1-Inch Touch Screen HMI Panel PC
  • Beckhoff CP7132-0001 - Industrial Built-In Panel PC Screen
  • Beckhoff CP2912-0010 - Multi-Touch Built-In Control Panel Display
  • Beckhoff CP2915-0000 - 15-Inch Multi-Touch Built-In Control Panel
  • Beckhoff AM8532-1EN0-0000 - Synchronous Servo Motor
  • Beckhoff AX5203-0000 - 2-Channel Digital Compact Servo Drive
  • Beckhoff CX2020-0141 - Embedded PC Core CPU Module
  • Beckhoff CP6832-0002-0010 - Built-In Industrial Control Panel Display
  • Beckhoff CX5020-0112 - Embedded PC CPU Control Module
  • Beckhoff CX5140-0175 - 4GB Embedded PC CPU Unit 24V
  • Beckhoff EL3681-0030 - Digital Multimeter Calibration Terminal EtherCAT
  • Beckhoff CP7201-1000-0000 - Industrial PC Touch Screen HMI Monitor
  • Beckhoff CP7232-1001-0000 - Industrial Panel PC Touch Screen
  • Beckhoff C6930-1032-0040 - Control Cabinet Industrial PC System
  • Beckhoff AX5125-0000 - 3 Phase Industrial Servo Drive 1000Hz
  • Beckhoff CP3916-1424-0000 - Multi-Touch Built-In Control Panel
  • B&R 1900071142 - Lemoine Fieldbus Communication Interface Module
  • Beckhoff EL2872 - 16-Channel Ribbon Cable Digital Output Terminal
  • Beckhoff CX2030-0120 - Embedded PC CPU Base Module Controller
  • Beckhoff CP3919-0000 - 19-Inch Multi-Touch Control Panel Touchscreen
  • Beckhoff AX5101-0000-0202 - Servo Driver Compact Intelligent Drive 180V
  • Beckhoff CX5130-0135 - Embedded PC Controller Module
  • Beckhoff CP3719-1061-0010 - Multi-Touch Panel PC Outer Housing Enclosure
  • Beckhoff CP3919-1033-0000 - 19-Inch Touch Industrial Panel Keyboard
  • Beckhoff CX5020-0111 - Embedded PC PLC CPU Module
  • Beckhoff FC5102-0000 - 2-Channel CANopen PCI Control Board Card
  • Beckhoff CX9001-1101 - Embedded PC CPU Network I/O System Module
  • Beckhoff CX1100-0920 - Smart Position Sensor Interface Module
  • B&R 4P3040.01-490 - Operator Panel PLC Interface Communication Module
  • Beckhoff CP2612-0000 - Dual-Touch Built-In Panel PC HMI
  • Beckhoff CP7002-1043-0010 - Touchscreen Display HMI Panel Terminal
  • Beckhoff CX9020-0115 - Embedded PC Controller Module
  • Beckhoff CX5140-0155 - 4GB Embedded PC CPU Module Die Industry
  • B&R 7DI435.7 - System 2005 Universal Digital Input Output Module
  • Bihl+Wiedemann BWU1568 - AS-i Master to Profibus Gateway Module
  • Beckhoff C6920-0070 - Control Cabinet Industrial PC 8GB Win 10
  • B&R X20AI2322 - 2-Channel Temperature Analog Input Module
  • Beckhoff CP2912-0000 - 12-Inch Touchscreen Display Monitor Screen
  • Beckhoff CP6022-1001-0010 - 15-Inch Built-In Control Panel
  • Beckhoff AM8031-0D10-0000 - Synchronous Servo Motor
  • Beckhoff CX5010-0111 - Embedded PC Controller CPU Module
  • Beckhoff CP7232-1000-0000 - Industrial Panel PC Touch Display Screen
  • Beckhoff CP7802-0011-0000 - 15-Inch Industrial Touchscreen Control Panel
  • Beckhoff C6320 - Control Cabinet Industrial PC
  • Beckhoff CX1030-0012 - Basic CPU Module Windows CE 6.0
  • Beckhoff CP2919-0000 - Installation Multi-Touch Control Panel
  • Beckhoff CX1020-0000 - Controller Set Stack System Pack
  • B&R 3DO480.6 - System 2005 Digital Output Module
  • Beckhoff EL3101 - 1-Channel Analog Input Terminal Differential +/-10V
  • Beckhoff AX8108-0200-0000 - Axis Feed Module Servo Drive