In this section, you will create a LabVIEW interface to the Modbus addresses called an I/O Server. The I/O Server automatically updates LabVIEW with the current values.
In this section, you will learn to create shared variables bound to the Modbus addresses, giving you native access in LabVIEW to PLC data. With the shared variable you can share data across LabVIEW applications on a single computer or across the network.
Now data flows from the Boolean push button to the shared variable when the VI is running.
The while loop causes the code within it to execute continuously until stopped by the user or additional logic in the VI.
Figure 13: Viewing Coil1's value in Distributed System Manager
Note: The Distributed System Manager began shipping with LabVIEW 8.6. Previous versions of LabVIEW did this by going to Tools»Shared Variable»Variable Manager and dragging the shared variables into the Watched Variables: window.
In the first section of the document we created a Modbus Master that writes a Boolean value to a Modbus coil. This coil value is being stored in a Shared Variable that we then were able to see in the Distributed System Manager. In this next section we will show how a Modbus Slave can read the coil value that the Master is updating. The Modbus Master we created in part one is looking for a Modbus Slave at IP address 127.0.0.1 (localhost). So we need to create a Modbus slave on your local machine if we want to talk via Modbus to our Modbus Master.
To improve your understanding of the relationship between Modbus Masters and Slaves, a useful challenge would be modifying your Modbus Master program to read and control the rest of the values in the Modbus Simulator. You will need to add bound Shared Variables to the Modbus I/O Server in the ModDemoProject.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.