Siemens S7 1200 Modbus TCP communication with Windows client

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello welcome to my second tutorial today I would like to show you how to set up Modbus tcp/ip communication between siemens s7 1200 and Modbus terminal Modbus terminal is great for testing as you can see incoming messages and can also reply back to PLC instead of the terminal you can you any device which supports Modbus for the PLC programming you just need TI a portal no special license or hardware is needed all functions are already included in standard license if you would like to use Modbus over RS 485 there is a neat little module which you can plug in front socket of the PLC and it's also inexpensive too it's a good idea to know a little bit about Modbus protocol I will explain the basics but for a more in-depth information check the web Modbus master slave protocol master is also called client slave is called server which is a little bit confusing slave is listening on given port master is responsible for initiation of the connection for storing of the data Modbus uses registers for values they're called holding registers for binaries they're called input registers Modbus message consists of address of opposite device function day 2 and CRC check there are four functions every one is defined by number three is read holding register four is read input register five is write single coil and six is right single holding register in tier portal they are numbered slightly different see the help file alright let's start first we create a new project in tier portal and add s7 1200 PLC you let's change the IP address be aware that computer on which we are running Modbus client have to have IP address from same subnet I will activate clock memory bits they are good for timings you you can find Modbus functions in right panel under instructions open communication tab as the PLC will be master in other terminology client we will insert MV client function you I will create DB for controlling a function and also for connection definition you if you are unsure about anything visit help file it's well described there you connection definition of data type of on ipv4 you interface it is shown in hardware can duration you Eydie is identification of the connection if you using more than one Modbus function you have to have unique it for every function connection type is 11 which means TCP active means master IP address is address of PC in this case you modbus usually uses port 5 to you in this table you can see Modbus function and corresponding Siemens numbers you now I need DB for sending and received data you create array of indoor boo lean but insert whole array not individual elements you day two addresses starting address of holding register which we going to read from data length is how many bytes from starting address we're going to read you data PTR is receiving array in dB you that should be all now just download the program you I'm using Modbus slave software which is running on the PC which is connected to PLC by Ethernet cable and have IP defined in connection DB in the client select right port right address and click listen in log window you can see incoming connection from PLC but no incoming data you status display 7004 which could be caused by Modbus United which is defined in Modbus function DB this ID is usually used in Modbus RTU communication but some devices requires this it to be one check your device manual you now Modbus slave client properly that Siemens using function number three but holding registers in slave clients are empty so I will add some random values and we can see they're being transferred to PLC you for sending function I will also use Modbus client function but parameters will be the same only ID will be different as I said earlier you for writing multiple registers Siemens uses function number 116 you now just had some numbers to sending Debbie and will be received by slave client in the case it's not working check status number but this number is being overwritten so it's a good idea to save its value when Arab it is on sometimes you have to restart PLC to make the function to work some devices requires to disconnect after every transfer other not refer to your device manual also be careful when editing DB's if you're online with DB there are two values when is starting value which is loaded when plc starts and other one monitored value which is in the plc right now always change both also check the firewall if it's not blocking the Modbus traffic that's all folk links for software and project and below the video thank for watching
Info
Channel: Industrial Automation
Views: 45,556
Rating: undefined out of 5
Keywords: Siemens S7, TIA Portal, V15.1, Modbus TCP, Siemens Modbus TCP, PLC Programming, Modbus master
Id: n2lBCGkPwzk
Channel Id: undefined
Length: 17min 48sec (1068 seconds)
Published: Sun Oct 06 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.