Welcome to the Industrial Automation website!

NameDescriptionContent
HONG  KANG
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)

来源: | 作者:佚名 | 发布时间 :2023-11-21 | 365 次浏览: | 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) :

id: indicates the ID of the configured connection in Configure Network. The connection ID is the unique identification of the connection between the CPU and the connection partner through the CP. Enter the number for the connection configuration here. This parameter ranges from 1 to 64.

db_param: parameter data block that contains modbus data parameters for the modbus block instance. The CPU determines the value range of this parameter. DB number 0 is reserved for the system and cannot be used. Enter the DB number "DBxy" in plain text format. If multiple connections are to be implemented, the parameter data block can contain the parameters required for all connections in order.

REG_KEY_DB: Registration key used for authorization.

MONITOR: Monitoring time MONITOR is used to monitor incoming data from connection partners. The time format T# is used to specify the monitoring time. It is recommended that the monitoring time be about 1.5s.

In "S7 as server" mode, the input of the second part of the frame is monitored by MONITOR time. If the monitoring time is exceeded, an error is reported. This time is calculated from the receipt of the MODBUS/TCP specific packet header and ends when the request is fully received.

Init: initializes the Modbus block when there is a rising edge in the parameter. Initialization can only be performed if no jobs are currently running. This condition must be ensured in the program by ENQ_ENR = FALSE and BUSY = FALSE.

(2) Parameter data block DB2

Parameter data block DB2 (name MODBUS_PARAM_CP). This parameter DB block is used to set the modbus data area.

Notice To modify Data in the DB block, switch the DB block to Data view and modify the DB block in the Actual value column.

In this example, you need to change DB2 ID2_ID to 16#1 according to the connection Settings in Figure 3-7. To facilitate the mapping of subsequent communication test addresses, change the start and end addresses of the modbus register to 16#0 and 16#1F3 respectively.

3.4 Communication Test

Download the project to the CPU, open the Modsan32 application, the following to the hold register as an example to introduce the communication test process.

First, select connect under the Connection menu for ModScan32 and set the IP address and port number for ModScan32 to access the PLC as the server side.

Finally, set the start address and length of Modbus to be accessed in Modscan32 software (in this test, Modscan32 uses data type 3 and the start address of the access hold register is 10 words of 40001), establish a communication connection with PLC, and carry out data reading.

You can view the communication status in the network configuration window.

Some considerations for using the function block "MODBUSCP" :

1) The S7-300CPU supports communication with multiple Modbus clients through the function block "MODBUSCP" of the Ethernet module CP343-1. The number supported depends on the number of TCP connections supported by the CP343-1. The function block "MODBUSCP" must be invoked once for each client connection. Parameters such as background data block, ID, and port number must be unique.

2) The S7-300CPU can be used as the Server and Client of Modbus TCP through the Ethernet module CP343-1.

3) The S7-300CPU supports multiple protocols through the Ethernet module CP343-1, which can run PROFINET, TCP/IP, S7 and other protocols in addition to Modbus TCP.

4 Configure the Ethernet module as the Modbus TCP Client to establish communication with the communication partner

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


  • Honeywell 001649-M5T028 - Tata Printed Circuit Board Rev: 0
  • Honeywell C7012A1145 - 1PC New UV Flame Detector Expedited Shipping
  • Honeywell OV210 - Baxter Bakery Oven Igition Control. For DRO. 00-616973 NEW
  • Honeywell 51304431-125 - 1PC New /51304431125 1 year warranty#XR
  • Honeywell QPP-0002 - Quad Processor Module / 5 Vdc / Massima 1.2A/24Vdc/max.25mA
  • Honeywell QPP-0002 - Quad Processor Module / 5Vdc / Max. 1.2A/24Vdc/max.25mA
  • Honeywell 8C-PCNT02 - 514543363-275 module
  • Honeywell DPCB21010002 - Tata Printed Circuit Board
  • Honeywell DPCB21010002 - Tata Printed Circuit Board Rev: 0
  • Honeywell 30735863-502 - SWITCH
  • Honeywell TK-CCR014 - REDUNDANT NET INTERFACE NEW ORIGINAL FREE EXPEDITED SHIPPING/
  • Honeywell 51403165-400 - new 51403165400/
  • Honeywell 318-049-001 - "100 Batteries(Japan Liion2Ah14.8Wh)INTERMEC/ PR2,PR3 P/N.:."
  • Honeywell FC-PSU-UNI2450U - Power Supply
  • Honeywell 965-0676-010 - WARNING COMPUTER SV
  • Honeywell 51403519-160 - module
  • Honeywell 107843 - HOUSING CARBON FILE P/N NE COND # 11438 (4)
  • Honeywell VR434VA5009-1000 - Brand new in box Condensing boiler valve DHL fast shipping
  • Honeywell SPXCDALMFX - plc new FREE EXPEDITED SHIPPING/
  • Honeywell BCM-PWS - BCM-ETH BCM-MS/TP BCM-MS/TP Network controller setFedEx or DHL
  • Honeywell YSTR12D-22/C/-2J0DFA/BE/400/T/-CM.HO.TG.SB.SM,ZS,F1,LP,/FX/,1C-BT - UNMP
  • Honeywell IWS-1603-HW - 90-250VAC 1.0A UNMP
  • Honeywell 51304386-150 - MEASUREX Factory Packed
  • Honeywell CC-IP0101 - Profibus Gateway Module
  • Honeywell CC-PFB401 - / CCPFB401 (NEW IN BOX)
  • Honeywell 50071726 - St 800 Series Pressure Transmitter Remote Diaphragm 11-42VDC
  • Honeywell 621-2150 - / 6212150 (NEW NO BOX)
  • Honeywell 80360206-001 - USED YAMATAKE CLI BOARD
  • Honeywell BMDX001A-001 - ACCURAY / BOARD BMDX001A001
  • Honeywell XCL8010A - New CPU Controller.
  • Honeywell PGM-7320 - 1PCS NEW Rae Systems MiniRAE 3000 Portable VOC Monitor#XR
  • Honeywell BK-G40 - U65 *FULL INSTALLATION* Gas Meter 3?± Inlet/Outlet Spool NEW UNUSED
  • Honeywell DM106-0-B-00-0-R-1-00000-000-E0 - DPR100 250V NSNP
  • Honeywell KFD840 - PRIMARY FLIGHT DISPLAY CORE PN: 066-01206-0104
  • Honeywell 51401914-100 - 51400996-100
  • Honeywell TK-PRS021 - Module Via FEDEX/DHL
  • Honeywell C7012A1145 - 1PC New UV Flame Detector Expedited Shipping
  • Honeywell OV210 - Baxter Bakery Oven Igition Control. For DRO. 00-616973 NEW
  • Honeywell 51304431-125 - 1PC New /51304431125 1 year warranty#XR
  • Honeywell QPP-0002 - Quad Processor Module / 5 Vdc / Massima 1.2A/24Vdc/max.25mA
  • Honeywell QPP-0002 - Quad Processor Module / 5Vdc / Max. 1.2A/24Vdc/max.25mA
  • Honeywell 8C-PCNT02 - 514543363-275 module
  • Honeywell DPCB21010002 - Tata Printed Circuit Board
  • Honeywell DPCB21010002 - Tata Printed Circuit Board Rev: 0
  • Honeywell 001649-M5T028 - Tata Printed Circuit Board Rev: 0
  • Honeywell YSTD924-(J2A)-00000-FF,W3,TP,TG,SS - NSFS
  • Honeywell XF523-A - / XF523A (NEW IN BOX)
  • Honeywell TK-PRS021 - NEW IN STOCK ship by UPS
  • Honeywell 2MLR-AC22 - " 2mlr-dbsf,2mlf-ad4s,2mlf-dc4s,2mlr-ac22 Rack"
  • Honeywell 9436610 - MEASUREX NSMP
  • Honeywell RT10A-L0N-18C12S0E - RT10A.WLAN.IN.6803.CAM.STD.GMS
  • Honeywell 51305896-200 - P:C1 Rev D Nim Modem - FAST SHIP BY Fedex
  • Honeywell TK-FTEB01 - PCL module Brand New Fast Shipping By DHL
  • Honeywell 8694500 - Measurex Control Processor Module
  • Honeywell DR4500 - Truline and DR4300 Circular Chart Recorder
  • Honeywell EC-7850-A-1122 - / EC7850A1122 (NEW IN BOX)
  • Honeywell XNX-UTAI-RNNNN - NEW Universal transmitter DHL Fast delivery
  • Honeywell SPXCDALMFX - plc new One Year Warranty #
  • Honeywell TC-RPFM01 - C200 system card brand new Fast Shipping
  • Honeywell 51196655-100 - NSMP
  • Honeywell XCL8010A - / XCL8010A (USED TESTED CLEANED)
  • Honeywell 51198801-100 - NEW CPU INTERFACE BOARD UPGRADE KIT UPIU 51306154-100
  • Honeywell 84795 - Sputtering Target 5N Al5Cu 7830x11640x13050
  • Honeywell W7704A-1004 - / W7704A1004 (USED TESTED CLEANED)
  • Honeywell RA890G1229 - FOR FSG UV Protectorelay /PL3
  • Honeywell KFS-599B - 071-01576-0101 UHF Communication Control with Mods (28V)
  • Honeywell WPC2000 - WINTRISS 9683001 WINTRISS CLUTCH/BRAKE CONTROL *NO KEYS*
  • Honeywell C7012E1112 - 1PC C7012E 1112 Burner Detector New In Box Expedited Ship #
  • Honeywell 8C-TCNTA1 - C300 system card brand new Fast Shipping
  • Honeywell ANT67A - TCAS Antenna 071-01548-0100 w/ October 2023 Repaired 8130
  • Honeywell CC-PDIS01 - PLC Module Brand New Fast Shipping FedEx or DHL
  • Honeywell R7247C1001 - 2-4SECS NSMP
  • Honeywell ALI-80A - Collins Encoding Altimeter - P/N 622-3975-011 - Tested 8130 -Serviceable
  • Honeywell 001650-M5T028 - Tata Relay Circuit Board
  • Honeywell 51196886-100 - PC BOARDS (126201 - NEW)
  • Honeywell J-HAM10 - NSNP
  • Honeywell TC-IXL062 - 1PCS module New fedex or DHL
  • Honeywell 114M4910-6 - PISTON ASSY PN NS COND 12037
  • Honeywell C7076 - 191002B Sensor Amplifier 220/240v
  • Honeywell 510STR12D21A-B77P - NSNP
  • Honeywell 51304511-200 - Module Nim Modem Via FEDEX/DHL
  • Honeywell IC-600 - Integrated Communication Unit RCZ851E 7510700-806 Removed Working
  • Honeywell TC-IAH161 - 1PC NEW REDUNDANT NET INTERFACE one year warranty#XR
  • Honeywell 2001-100-150-126-280-20-100000 - REMAN
  • Honeywell QPP-0001 - FSC QUAD PROCESSOR PACK QPP MODULE CC V1.4
  • Honeywell 30734558-001 - / 30734558001 (USED TESTED CLEANED)
  • Honeywell STD830-E1HS4AS-1-A-ADB-11C-B-21A0-00-0000 - 4500PSI NSNP
  • Honeywell 900C75-0560 - NEW HC900 Controller module FedEx DHL Fast delivery
  • Honeywell BL870 - Bezel 7014331-921 w/ October 2018 Repaired 8130
  • Honeywell STG77L-E1G000-1-A-CDC-11S-A-20A0-00-0000 - NSMP
  • Honeywell FF-SB14E12K-S2 - / FFSB14E12KS2 (USED TESTED CLEANED)
  • Honeywell 51198685-100 - "Rev. A, 140519-2-LF Power Supply Module 10A 100-240 VAC"
  • Honeywell 942-M96-M - plc new FREE EXPEDITED SHIPPING
  • Honeywell TK-IAH161 - 1PC New ANALOG INPUT TKIAH161 Expedited Shipping
  • Honeywell C7061F2001 - 1PC UV Flame Detector New In Box #
  • Honeywell 0190-20139/D - ONE Sputtering Coating Disc 4N5TI NEW
  • Honeywell 82408667-001 - NEW MEMORY BOARD ROM/RAM 82408667001
  • Honeywell C7012A1194 - NEW IN STOCK ship by UPS
  • Honeywell TK-FTEB01 - NEW IN BOX FTE BRIDGE Brand New Fast Shipping FedEx or DHL
  • Honeywell RA890G1344 - 1pc NEW Combustion Controller DHL or FedEX
  • Honeywell DH-AP-1/ - Miller 3 Workers per System 4-3/4 Ft Overall H Post Anchor
  • Honeywell TCOAV081 - NEW IN BOX ANALOG OUTPUT EXPEDITED SHIPPING
  • Honeywell W7704D1016 - Control Unit
  • Honeywell 9437710 - USED PIDP MEASUREX / 09437710-RP MODULE REV D STOCK 1603
  • Honeywell 51403165-400 - Brand new industrial computer Fast FedEx or DHL
  • Honeywell DC3200-EE-000R-240-00000-E0-0 - New DHL FastShip
  • Honeywell 51305348-100 - / 51305348100 (USED TESTED CLEANED)
  • Honeywell CC-PAIX01 - 1PCS Brand New Expedited Shipping
  • Honeywell 51305890-175 - REV B NEW
  • Honeywell XCL8010A - NEW IN STOCK ship by UPS
  • Honeywell D18-UU0000-D00000-0000-2-0000-00-E - CHART RECORDER CHART RECORDER
  • Honeywell TC-IAH161 - ANALOG INPUT NEW 1PCS
  • Honeywell 10020/1/2 - / 1002012 (NEW IN BOX)
  • Honeywell DC3200-EE-000R-240-00000-E0-0 - Digital Controller UPS Express New Zy
  • Honeywell 2MLR-CPUH/F - 1PC NEW EXPRESS P3097E YL/
  • Honeywell 9437710 - USED PIDP MEASUREX MODULE REV D STOCK 1608
  • Honeywell CC-PAIX02 - Fast Shipping
  • Honeywell DPR500 - Brand New Fast Shipping By DHL
  • Honeywell 10004/I/F - / 10004IF (USED TESTED CLEANED)
  • Honeywell C7012E1112 - 1PCS New in box UV Flame Detector
  • Honeywell HPTZ-361W - Brand New Expedited Shipping
  • Honeywell 10006/2/1 - / 1000621 (NEW NO BOX)
  • Honeywell SC-PCMX01 - 1PC NEW RTU2020 51307195-175 SHIP EXPRESS #P2254E YL
  • Honeywell X-NPMS(H) - 1PC Network Paging Console Fire Equipment Brand New Via DHL
  • Honeywell C7012E1112 - 1Pcs new Explosion-proof flame detector
  • Honeywell 0190-20139/D - 4N5TI Sputtering Coating Disc
  • Honeywell RM7840E1016 - SER. 3 REV. 4141 120VAC 15SEC NSMP
  • Honeywell C7012E1120 - Brand new Fast shipping via DHL