

It could be that addresses 1 through can only be accessed from a read input registers command. On the LabVIEW side, the code is straightforward. We have an operator who wants to know the state of the switch (on or off) and the ability to. In this scenario, our Arduino is hooked up to a toggle switch and an LED. A Modbus client (LabVIEW) sends its messages on the port 502, and a Modbus server (PLC) receives messages on 502. Below is example code that shows how we can use our newly created RS485 network and Modbus library using a very simple (and probably unrealistic) scenario. The focus here would not be the entire protocol but just start with understanding the memory map in Modbus and some of the basic function calls. Local Port: This is the outgoing port number of the local connection partner (value range: 1 to 49151), 502 is the default.
#Labview modbus example how to
For the 1200/1500 CPUs Siemens provides a lot of example projects showing how to do stuff. You probably want the server on the PLC, and Labview being the client.
#Labview modbus example manual
I highly suggest you read up a bit on the basics of Modbus first before you dive in and try to communicate. Theres a manual and a example project with a modbus/TCP client and server on 1200-series PLC. Although the register def file is pretty cryptic (a nice secret decoder ring would be nice ), it looks like address 1 through 35 can be accessed with a read function and 201 through 203 from a write holding registers command. You could use a known Modbus master like Modpoll to help you troubleshoot the communication. Make sure the Modbus ID and Baudrate used in the Modbus RTU slave device. I would first try to read 1 word at the first address and see if you can get some data from the device. How to communicate with Modbus RTU slave device in LabVIEW 1. The examples that ship with the NI Modbus Library are probably not going to work without some modification to the reading and writing. I know that Modbus I/O Servers supports RTU but have never used it myself. If you have Labview DCS or RT, you could use the Modbus I/O Servers. The NI Modbus Library supports RTU and ASCII. Next thing to find out is if the unit your trying to communicate to is a master or slave.
