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 | 1506 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) :

  • National Instruments NI 9264 Output Module
  • National Instruments IC-3173 Controller
  • National Instruments NI 9234 Vibration Module
  • National Instruments SMB-2163 DIO Accessory
  • National Instruments PXIe-1062Q DSA System
  • National Instruments USB-6289 DAQ Device
  • National Instruments NI 9233 Vibration Module
  • National Instruments PXIe-5840 VST
  • National Instruments PXI-1033 and PXI-6132 System
  • National Instruments GPIB-USB-HS+ Controller
  • National Instruments NI 9231 Sound and Vibration Module
  • National Instruments cRIO-9074 CompactRIO Controller
  • National Instruments 782536-01 DAQ Module
  • National Instruments 779781-01 DAQ Module
  • National Instruments PXIe-8388 MXI Express Controller
  • National Instruments SCXI-1520 Strain Bridge Module
  • National Instruments PCIe-6320 Multifunction DAQ Card
  • National Instruments NI 9234 Sound and Vibration Module
  • National Instruments USB-4431 Sound and Vibration Device
  • National Instruments NI 9227 Current Input Module
  • National Instruments PXI-1033 PXI Chassis
  • National Instruments NI 9213 Thermocouple Module
  • National Instruments PXI-1042 PXI Chassis
  • National Instruments PXI-6229 DAQ Card
  • National Instruments cRIO-9075 Controller
  • National Instruments PCI-6033E DAQ Card
  • National Instruments PCIe-6363 DAQ Card
  • National Instruments cDAQ-9174 Chassis
  • National Instruments PXIe-8880 PXI Controller
  • National Instruments NI 9242 Analog Input Module
  • National Instruments USB-6221 BNC DAQ Device
  • National Instruments NI 9220 Analog Input Module
  • National Instruments cRIO-9068 CompactRIO Controller
  • National Instruments PXI-4130 Source Measure Unit
  • National Instruments USB-6251 Multifunction DAQ Device
  • National Instruments PXI-8106 Embedded Controller
  • National Instruments USB-6218 Multifunction DAQ Device
  • National Instruments PCIe-1473R Camera Link Frame Grabber
  • National Instruments PXIe-4341 DSA Module
  • National Instruments PXI-8102 Embedded Controller
  • National Instruments cDAQ-9178 Chassis
  • National Instruments USB-6210 DAQ Device
  • National Instruments USB-6212 DAQ Device
  • National Instruments NI 9485 Relay Output Module
  • National Instruments NI 9208 Current Input Module
  • National Instruments PXIe-4141 SMU
  • National Instruments PCI-6154 DAQ Card
  • National Instruments cRIO-9038 Controller
  • National Instruments PCI-6133 DAQ Card
  • National Instruments LabVIEW RIO Kit 501684G
  • National Instruments PXIe-6396 Embedded Controller
  • National Instruments USB-8502 CAN Interface Device
  • National Instruments NI 9264 Spring Terminal Output Module
  • National Instruments NI 9213 Thermocouple Input Module
  • National Instruments NI-9205 Analog Input Module
  • National Instruments NI 9264 Analog Output Module
  • National Instruments USB-6212 Multifunction I/O Module
  • National Instruments PXI-4071 FlexDMM Multimeter Module
  • National Instruments NI-9208 DSUB Current Input Module
  • National Instruments PXIe-6363 X Series I/O Module
  • National Instruments NI 6587 LVDS Digital I/O Module
  • National Instruments PCI-6225 Data Acquisition Card
  • National Instruments NI-9262 Analog Output Module
  • National Instruments NI 9235 Quarter Bridge Input Module
  • National Instruments PXIe-8301 Remote Control Module
  • National Instruments PXI-4071 FlexDMM Module
  • NI-9234 Sound and Vibration Input 779680-01
  • NI 9229 Isolated Analog Input Module
  • NI cDAQ-9178 USB CompactDAQ Chassis
  • National Instruments NI 9220 143613B-06L Analog Input Module
  • NI 9229 Analog Input Module
  • NI 9246 Analog Input Module
  • NI PXIe-1071 PXI Express Chassis
  • National Instruments 9225 780159-01 Analog Input Module
  • NI cDAQ-9171 USB CompactDAQ Chassis
  • NI PXIe-8840 Embedded PXI Controller
  • Bonfiglioli A202 UH35 FIA 39.6 Right Angle Reducer
  • Bonfiglioli BN 90 LA 4 Gearmotor 1.5kW i=14.1
  • Bonfiglioli BN71A4 Motor with C313PP71 Gearbox
  • Bonfiglioli MP 130 1 4 STD 114A CD Planetary Gear Head
  • Bonfiglioli LC155 1 10 STD Gearbox
  • Bonfiglioli Vectron ACU401-13 FA Inverter
  • Bonfiglioli AEC500-31A Solar Inverter
  • Bonfiglioli BN63B6 Geared Motor VF44P
  • Bonfiglioli Vectron ACT410-23 Inverter
  • Bonfiglioli FR FRIZ 11/90 Clutch
  • Bonfiglioli A/11.90 B3 Clutch Brake
  • Bonfiglioli 50.180.3000 Servo Motor
  • Bonfiglioli NFF 14 112 EE Clutch
  • Bonfiglioli BMD 65 Permanent Magnet Motor
  • Bonfiglioli MP 080 2 20 STD 73A1 CD Planetary Gearbox
  • Bonfiglioli VF/VF30/63 P1 1520 Gearbox
  • Bonfiglioli M3SA4 FD with X F202 H35 10.0 Gearbox
  • Bonfiglioli ACU401-19A Frequency Inverter 5.5kW
  • Lafert B6306P-02276 Servo Motor with Bonfiglioli A102
  • Bonfiglioli ACU401-09FA Frequency Inverter 1.1kW
  • ProMinent Sigma S1CBH12035 with Bonfiglioli BN56B4
  • Bonfiglioli TR 080 2 20 STD Planetary Gearbox
  • Bonfiglioli ACT400-040A Frequency Inverter 15kW
  • Bonfiglioli BE 132 MA 4 Electric Motor 7.5kW
  • Bonfiglioli W86 U30 P100 Gearbox
  • Bonfiglioli MP105 2 25 Planetary Gearbox
  • Bonfiglioli BE160L4 Motor 15 kW
  • BONFIGLIOLI TMP-105 2 25 15 19 40 70 90 Planetary Gearbox
  • Bonfiglioli Vectron ACU401-18 FA Inverter
  • BONFIGLIOLI BE80B4 Motor with A302 UH35 76.5 P80 VA Gearbox
  • Bonfiglioli Vectron VCB400-180 Inverter
  • Bonfiglioli P63B14B3 Motorization Encoder
  • Bonfiglioli Vectron ACT201-13FA Inverter
  • Bonfiglioli F202 H30 P90 Gearbox
  • Bonfiglioli BN71A4 C313 P P71 Gearmotor
  • Bonfiglioli ACT201-11FA Frequency Inverter
  • Bonfiglioli ACU410-21 3 FA Inverter 7.5kW
  • Bonfiglioli RA0 60/00 Gear Reducer i=182
  • Alpha VDS 063-MF1-10-141-BE Planetary Gear 20018280
  • Stöber FDR 71B/10 Gearmotor 0.37kW
  • Stöber DW0-2000-037-4 Gearbox 0.25kW
  • Bonfiglioli M3SA4 FD R with X F252 H35 16.6 Gearbox
  • Bonfiglioli BN90LA4 Adjustable Gear Motor 1.5kW
  • Alpha LP 090-MO1-5-111-000 Planetary Gearbox
  • Bonfiglioli 335 M3 C Planetary Gear Motor
  • Bonfiglioli TR060 2 18 STD 50C CD 14 S1 OR SB KE Gearbox
  • Bonfiglioli MP1GD3036L001 Gearbox
  • Bonfiglioli BN90LA4 Gear Motor 1.5 kW
  • Bonfiglioli A302 UH35 P90 Gearbox
  • Bonfiglioli ACU410-31A5 Inverter
  • BONFIGLIOLI BMD 118 14 4500 400 165 SS TC1 RES2 P1N S1N CUS JB00013358
  • Bonfiglioli A302 UH40 P90 Reducer