
In the NI Example Finder browse to Toolkits and Modules» Datalogging and Supervisory Control» I/O Servers double click on Modbus Simulator.lvproj.In LabVIEW open the NI Example Finder by clicking on Help✿ind Examples.So we need to create a Modbus slave on your local machine if we want to talk via Modbus to our Modbus Master. The Modbus Master we created in part one is looking for a Modbus Slave at IP address 127.0.0.1 (localhost).
In this next section we will show how a Modbus Slave can read the coil value that the Master is updating. This coil value is being stored in a Shared Variable that we then were able to see in the Distributed System Manager. In the first section of the document we created a Modbus Master that writes a Boolean value to a Modbus coil. Viewing the Coil Value With a Modbus Slave Previous versions of LabVIEW did this by going to Tools»Shared Variable»Variable Manager and dragging the shared variables into the Watched Variables: window. Note: The Distributed System Manager began shipping with LabVIEW 8.6.
Use the Connect Wire tool to wire the Coil1 shared variable to the Boolean push button by clicking on the Coil1 shared variable and then on the Boolean push button, as shown in Figure 6.įigure 13: Viewing Coil1's value in Distributed System Manager. Right click on your newly placed Coil1 Shared Variable and select Access Mode»Write. This allows you to write to instead of read from the Shared Variable. The shared variable acts as a source of data to other terminals on the Block Diagram. Drag and drop the Coil1 Shared Variable from the Project Explorer to the Block Diagram of the VI. In the Project Explorer, expand the ModbusDemoLibrary library and select the Coil1 shared variable. By pressing the push button on the front panel, you change the Boolean value passed out of the icon terminal on the block diagram. Notice the icon on the Block Diagram, which represents the push button on the Front Panel. The Block Diagram is where you build the behavior of your application. In the VI, select Window»Show Block Diagram or press Ctrl+E to show the Block Diagram. Select a push button from the Controls palette by selecting Express✻utton & Switches»Push Button, and place it on the Front Panel, as shown in Figure 4 and 5.įigure 5: Push Button Placed on the Front Panel. Mouse over the various categories to explore the UI components in LabVIEW. Select View✼ontrols Palette or right-click anywhere on the Front Panel to bring up the Controls palette. LabVIEW has many built-in UI components, such as graphs, charts, dials, and so on, which you can use to build a powerful, intuitive UI. By default, you see the Front Panel, which is the user interface of the VI. A VI is used to create a user interface and executable graphical code. This creates a new virtual instrument or VI. From the Project Explorer, right-click My Computer and select New»VI. You now have access to Modbus data natively in LabVIEW through the shared variables This publishes the shared variables, making them available on the network to other computers. Deploy the shared variables by right-clicking on ModbusDemoLibrary and selecting Deploy All. Note: The LabVIEW DSC Module enhances shared variables by adding the ability to log data, alarms, and events directly to a database without ever writing a LabVIEW application. Then select 000001-065535, and click on Add Range. Leave the default of Data Item as 000001 and Number of items as 1. Hit OK.
In the Create Bound Variables window, expand the tree down to the Modbus1 in order to select the desired address range.Right-click the newly created ModbusDemoLibrary and select Create Bound Variables….Create new shared variables that are bound to the Modbus addresses.With the shared variable you can share data across LabVIEW applications on a single computer or across the network. In this section, you will learn to create shared variables bound to the Modbus addresses, giving you native access in LabVIEW to PLC data. Save the project as ModbusDemoProject and the library as ModbusDemoLibrary by selecting File»Save All from the project explorer window.īind Shared Variables to Modbus Addresses Through the I/O Server.Select OK. A library is automatically created in your Project Explorer window to manage the I/O Server.In this example we are running the Modbus Slave on the same computer as the master, so we use the localhost IP address, 127.0.0.1.
#MITSUBISHI PLC SERIAL COMMUNICATION PROTOCOL HOW TO#
If you don’t know how to determine a computer’s IP address refer this web page: External Link: How to Find IP Information. Enter the IP Address of your target Modbus Slave in the IP address field.Figure 2: Configuring Modbus Master I/O Server