Modbus TCP communication example for Siemens 1200/1500 series PLC

Publisher:TechWhizKidLatest update time:2023-09-15 Source: elecfansKeywords:Siemens Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In modern industrial production, it is often the case that the host computer needs to communicate with the third-party slave computer, such as third-party instruments, inverters, temperature modules, pressure transmitters, etc. In this case, ModbusRTU and ModbusTCP/IP protocols are required. If your third-party device supports the ModbusTCP/IP protocol, network communication can be used.


Today we will introduce the TCP communication of Siemens 1200 and 1500 using the TIA Portal platform. After reading this case, you can draw inferences from it and apply it to actual projects. This case is for reference only.


We need to meet the following software and hardware requirements when doing this project case:

1.) A Siemens 1200 series PLC (in this case, it is 1215DCDCDC. The controller does not have to be the same as the one in this case, as long as it supports the modbusTCP protocol);

2.) A Siemens 1500 series PLC (in this case, it is 1513, the controller does not have to be the same as this case, as long as it supports the modbusTCP protocol);

3.) A computer with TIA Portal V16 software installed;

4.) Two communication network cables and one DC24V/10A switching power supply.

After the above conditions are met, we open the TIA Portal and start configuration. Here we first configure a server (1513PLC) and create a server communication data DB block:

wKgZomRHOamAT7mMAAKaiyT3fn0444.jpg

How to build:

Add a data block named "TCON_IP_V4" in "Program Block". There is no need to cancel "Access Optimization Block". Add communication data with the data name "TCON" and data type "TCON_IP_V4" in the static variable "Static".

Open the "TCON" data to set the parameters, set "Interfaceld" (communication hardware port) to "64", set ID to "8", set "Connection Type" (communication protocol) to 16#0B, the default is TCP communication protocol, "ActiveEstblished" (establish connection), "1" is active connection (client), "0" is passive connection (server), continue to open "RemoteAddress" and find the "ADDR" array to set the communication IP address (generally not set by default as a server), and finally set the "LocalPort" server port number to "502".

We call the TCP communication instruction block "MB_SERVER" and drag it to the program terminal to set parameters:

wKgaomRHOaqAXBG9AAOOYTmzNr4549.jpg

After writing the server program, we configure a client PLC (i.e. 1215PLC). After configuration, we also need to add a communication data DB block, which is slightly different from the server parameters, as shown in the following figure:

wKgZomRHOaqAbqFWAAOiFTZWAqo506.jpg

The data block parameters of client and server "TCON_IP_V4" differ in the following parameters:

1.) Active Established (Established connection), "1" for active connection (client), "0" for passive connection (server). This is a client, so fill in "1"

2.) Open "RemoteAddress" and find the "ADDR" array to set the communication IP address (here is the client, you need to fill in the server IP address, that is, Siemens 1513PLC);

3.} Remote Addrese here needs to fill in the server port number (502);

4.) LocalPort" server port number is "0".

After the communication parameters are set, add a TCP communication instruction "MB——CLAYend" as shown below:

wKgaomRHOauAWz3BAAMpGuxxLJU133.jpg

Writing data from the client to the server

We add a program to read the server:

wKgZomRHOauAJneNAAENt-3PLQs570.jpg

Read server data from client (server writes data to client)

Read requirements:

The five data of MW20-MW28 on the server side (Siemens 1513) are stored in MW50-MW58 on the client side (Siemens 1215). It can also be said that the server writes to the client side.

The controller online monitoring is as follows:

wKgaomRHOayAG3R2AAG1lq9YK88047.jpg

Condition Monitoring:

wKgZomRHOa2AHVH6AAKc0ShSA00272.jpg

1200/1500 data transfer

The above is a brief introduction to the data transmission between 1200 and 1500 PLCs through the Modbus TCP communication protocol. I hope it can provide a reference and help for friends who want to learn Siemens PLC communication. There are inevitably some imperfections or even errors in the article. I hope the experts will criticize and correct me.


Keywords:Siemens Reference address:Modbus TCP communication example for Siemens 1200/1500 series PLC

Previous article:The principle, advantages and disadvantages of belt conveyor belt anti-deviation device
Next article:Three steps to teach you how to play S7-1500OPC communication configuration and OPC communication

Recommended ReadingLatest update time:2024-11-16 09:39

Infineon launches 1200 V CoolSiC MOSFET M1H chip with enhanced features to further improve system energy efficiency
Infineon Technologies AG has released a new CoolSiC™ technology, the CoolSiC™ MOSFET 1200 V M1H . This advanced silicon carbide (SiC) chip is used in the popular Easy module series, as well as discrete packages based on .XT interconnect technology, with a very broad product portfolio. The M1H chip h
[Power Management]
Infineon launches 1200 V CoolSiC MOSFET M1H chip with enhanced features to further improve system energy efficiency
What is the function of Mitsubishi PLC auxiliary relay M0
Mitsubishi PLC (Programmable Logic Controller) is a control device widely used in the field of industrial automation. In Mitsubishi PLC, auxiliary relays (M relays for short) are a very important component, which play the role of auxiliary control and status indication in the program. M0 is a special type of auxilia
[Embedded]
Programming the self-reset function of timers and counters in PLC
CTU: Adding counter Analysis: When the count value reaches 5, Q output M300.0 = 1, and reset is performed in the next cycle Instruction, so that the count value is cleared, then Q output M300.0 = 0, to achieve self-reset counter And generate pulse. M300.0 has a process of changing from 1 to 0.
[Embedded]
Programming the self-reset function of timers and counters in PLC
About the maintenance method of PLC external wiring
PLC programmable controller has logic control, timing control, analog control and multi-machine communication functions. To repair a PLC circuit, you do not need to understand the PLC program, but you must understand the PLC's external wiring. FX3SA-20MT PART.1PLC input wiring Taking FX
[Embedded]
About the maintenance method of PLC external wiring
Research on the design of sewage treatment system based on PLC control
introduction At present, with the rapid development of science and technology in my country, the clarion call of the poverty alleviation war has been sounded, and various small and medium-sized enterprises have sprung up like mushrooms covering the land, driving people out of poverty and becoming rich, but the
[Embedded]
Research on the design of sewage treatment system based on PLC control
PLC control system wiring and inverter interference suppression
Pay attention to power supply installation There are two types of power supplies for PLC systems: external power supply and internal power supply. The external power supply is used to drive the PLC output device (load) and provide input signals. It is also called the user power supply. The external p
[Embedded]
PLC control system wiring and inverter interference suppression
Analysis of common causes of PLC failure
(I) Failure of peripheral circuit components This type of failure often occurs after the PLC has been working for a certain period of time. If a component failure occurs in the PLC control loop, the PLC control system will automatically stop working immediately. The input circuit is the port through
[Embedded]
PLC pointer types and how to use indirect addressing
In the programming of Siemens S7-300 and S7-400, it is often necessary to call some system functions or function blocks. When inputting parameters, you often encounter pointer type parameters. Do you know the pointer type? The first time I came into contact with the term pointer was when I was learning C language. P
[Embedded]
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号