What is the S7-1200 scan time? Much of the Modbus processing is occurring with the MB_Server block, so increasing the communications scan % will not speed the in-program processing at all. If you are seeing very long scan times (100's of ms) in the S7-1200, then there might be cases where the S7-1200 is falling behind the modbus requests to the point where the response exceeds the timeout period. It may take a couple of PLC scans to process each Modbus request.
The way I would go about troubleshooting this problem is to set up a managed Ethernet switch between the S7-1200 and the TSX57 that supports port mirroring, and configure mirroring from the S7-1200 port to an unused switch port. I would then connect a PC with Wireshark installed to the mirror port on the switch. This will allow Wireshark on the PC to see all Ethernet traffic to/from the S7-1200. By filtering for Modbus protocol in Wireshark, You can reduce the Wireshark output to the Modbus traffic. Wait for the timeout error to occur, stop the Wireshark capture, then go through the Modbus frames in reverse time order until you see what is causing the problem. Look at the timestamp of requests and timestamp of responses to see if the S7-1200 is falling behind the requests. If you don't find any problem in the Wireshark capture (including server response time problems), then the problem is in the device that is reporting the timeout problem.
An alternative to a managed switch is an Ethernet tap: Siemens has the SCALANCE TAP104, and other vendors make similar products. Taps are passive devices that do not allow you to transmit on a network, but allow you to monitor Ethernet messages on a cable. Because they are less complex than a switch, they are generally less expensive than a switch, and don't require port mirroring capability.
I don't know exactly whether the Siemens S7-1200 supports modbus communication protocol but in case it is, you can use serial RX/TX Arduino lines, some MAX485 chips together with the Arduino modbus RTU library. It works fine.
Yes, the 1200 can do modbus RS232, RS485 or Modbus TCP I wish there was a nano wiznet shield.
I have the nano as a modbus TCP device with a DTH11 for temp and humidity.
I have been thinking this would be a great device to save wiring if you have a few signals and the plant has ethernet could save a lot of wiring cost. The main issue is how do you mount and wire it?
ellepiu:
I don't know exactly whether the Siemens S7-1200 supports modbus communication protocol but in case it is, you can use serial RX/TX Arduino lines, some MAX485 chips together with the Arduino modbus RTU library. It works fine.
The netbiter has modbus TCP&RTU support along with some support for ethernet IP. It looks like @lambs was using modbus RTU. You are correct if they were trying to go directly to the S7 with the netbiter it might have issues. An Ewon Flexy might be a better fit for an application like this.
My problem is as follows: I already connected LabView to my PLC (Siemens S7-1200) and everything works excellent. Labview is my Master and the PLC is a Slave. Everything works fine if the connect ID on the PLC is 1. If I change it, the connection can't be established. So I want to know if there is a way to change connect ID on the LabView side if I want my PLC to have some different value (for example 5).
This is implied by the previous response, but keep in mind that the connection ID really has little meaning in the IP context. It's really designed for multi-dropped (bussed) serial links where everybody broadcasts to everybody else, so it's the only means of evaluating "who said that?"
I am using the MB Ethernet Example Mater from the NI MODBUS Library 1.2.1. I modified that example to suit my needs. Connection ID is going out of the TCP Open Connection Function. Does that correspond to the Connect_ID on the PLC's modbus ? ? ?
That library has a Transaction ID and Unit ID within a wire-able input called the MBAP header. And as others have said it has little value in a ModbusTCP application. In fact the only time I have ever had occasion to use it was when a slave required some value other than the default 0. So I set it to constant '1'. I doubt this slave would work with any other value. Which may or may not be true of your slave(s).
And in the serial implementations of Modbus the Unit ID is the serial slave's node address. Which, in ModbusTCP is typically not used, as it is replaced by the IP address - (4 octets etc... 192.168.1.1 for example).
Unit ID should only be needed in TCP if you are using an Ethernet / Serial Gateway and need to address multiple slaves behind a single IP address. If your slaves are native ModbusTCP - then they will have unique IP addresses. What would you need to manipulate the Unit ID for?
I am currently working with two PLC's - experimenting. There is an input for one of the blocks for modbus communication called Connect_ID and it's on the PLC. As I explained in my first post the communication between PLC and LabView is only possible if that input has value 1. In the PLC - PLC communication that value needs to be the same so it could work. It works with every number (intiger).
I want to know if that parameter, whatever it is called, can be changed on the LabView side so I don't have to always change it on the PLC (one is programmed with Connect_ID=1 and the other one has Connect_ID=5).
I am attempting to setup a modbus TCP connection to a set of slaves behind a single IP address. Can anyone offer some insight into how to define the slave id in the Modbus TCP VI's? Any help is appreciated.
I try to read registers through a modbus client in an s7-1200, I have tried to follow the siemens guide and it seems that all the parameters are correct, nothing seems strange, it always gives me status 7006 and the busy bit is always 1
Hello i have a trb 245 and i want to get the io values and the system uptime via modbus tcp.
i have made the trb as a server and the s7 1200 as a client , but i dont receive anything. The s7 1200 shows it receives data but in my datablock everything is zero. Have anyone else done something similar and its working?
Please ensure you are accessing the correct register and using the right data type and function (read holding registers (3)). Also, check if the values you want to monitor are available for reading. You can find more information here: TRB245 Monitoring via Modbus - Teltonika Networks Wiki
hello thank you for your response. to select data type an function you mast be at client configuration. The trb i am using has the latest filmwere and in the images you can see it doesnt have any way of selectin data type or function. In the other image is the mb clinet i have in my plc
client img896531 15.2 KB
server img1545694 23.6 KB
ok no problem, i have tryed the method you suggested but it only reads and writes at the plc server . i never get uptime or coils. i will try it again and if it doesnt work i will reply here with pictures.
PLC Siemens umumnya mengalami kesulitan dalam koneksi modbus, khusunya ke peralatan dengan modbus serial seperti power meter, protection relay dan lainnya. sebenarnya dari versi sebelumnya bisa dilakukan tetapi semuanya tidak free, sekarang di plc siemens S7-1200 sudah bisa langsung dilakukan
Instructions
We have taken the example of MODBUS communication between a master and a slave. There is alternate writing to the holding register of the slave (function code 16) and reading from the holding register of the slave (function code 03). Since the RS485 has a two-wire interface (half-duplex), writing and reading must be conducted consecutively. By the same principle, the address of the slave to be addressed can be changed between two actions (here writing and reading), thus making it possible to exchange data with multiple slaves.
The CM 1241 RS485 communication modules are linked to each other using a PROFIBUS cable. You can continue with the PROFIBUS cable to connect up to 31 additional MODBUS slaves to the master. The configuration is made in STEP 7 (TIA Portal) and the program code is transferred to the controllers with the switch CSM 1277.
The MB_COMM_LOAD block is used to select the communication module, set the communication parameters and parameterize the connection with the master or slave parameters. The MB_COMM_LOAD block must be called in the first program cycle (by activating the system marker M1.0 in the hardware settings or by a call in Startup OB 100). After inserting the communication module in the hardware configuration you can select the symbolic name of the communication module at the PORT parameter. The communication parameters BAUD (transmission rate) and PARITY (parity) must be identical for all nodes. The port configuration of the RS485 interface in the STEP 7 (TIA Portal) device view is irrelevant here. The instance data block of the master or slave block is transferred at the MB_DB parameter and thus defines the communication module (PORT parameter) as MODBUS master or slave.
c80f0f1006