Sunteți pe pagina 1din 7

Overview: The purpose of this document is to provide step-by-step procedures for configuring National Instruments LabVIEW for communications

with WAGO Modbus I/O. The procedures that follow illustrate how to configure National Instruments Lookout Protocol Drivers OPC Server to handle the Modbus communication services and how to attach data made available by the OPC Server to discrete controls and indicators in a sample LabVIEW application. The procedures in this document have been tested with (but are not limited to) the following hardware/software configuration: Intel Pentium III PC running Windows NT 4.0 Operating System with Service Pack 6 National Instruments LabVIEW 6i National Instruments Lookout Protocol Drivers OPC Server, Version 4.0 Onboard RS-232 serial port WAGO 750-316 Modbus Buscoupler, RS-232 WAGO 750-400 2pt. Digital Input Module, 24VDC WAGO 750-501 2pt. Digital Output Module, 24VDC Serial Communications Cable, 9-pin D-Shell to 9-pin D-Shell, straight through connection Enter section headings, separating each section with a line break:
Configuring the OPC Server Writing a Client Application in LabVIEW Configuring the OPC Server

Configure the OPC Server as follows: 1. Select Start>>Programs>>National Instruments Lookout Protocol Drivers>>Lookout Protocol Drivers OPC Server 4.0 to launch the OPC Server configurator. 2. Select File>>New to start a new configuration. 3. Select Object>>Create to create a new database. 4. In the Select object class: dialog box (shown in Figure 1), select Modbus as the object class and click Ok.

Figure 1. Select Modbus as the Object Class 5. In the Create Modbus Secondary window, define the port parameters for your serial port and give the connection an appropriate name, such as ModbusConnection. Figure 2 shows the Create Modbus Secondary dialog box. Click OK.

Figure 2. Defining the Serial Port Characteristics

6. Select Object>>Edit Database. 7. In the Edit object database window, select the database created in steps 3 through 5 (ModbusConnection) and click Ok. 8. Configure the I/O points for the application by entering the Member (I/O Address) and Description for each point of I/O. Click Save after each Member and Description entry. The following table shows the Members and Descriptions used in this example: Member 000001 000002 100001 100002 Description WAGO Node 1 Output 1 WAGO Node 1 Output 2 WAGO Node 1 Input 1 WAGO Node 1 Input 2

Figure 3. Editing the Database 9. Click Quit once you have entered and clicked Save for all Members and Descriptions. 10. Select File>>Save As and type in a file name for the process, such as WAGO_Modbus_Connection. Then, click Save. 11. Select File>>Exit.

12. You will be prompted as to whether or not you want to make the current process file the startup file. Click Yes. The application will exit. The OPC Server is configured.

Writing a Client Application in LabVIEW

Complete the following steps to set up a client application in LabVIEW: 1. Launch LabVIEW 6i by selecting Start>>Programs>>National Instruments LabVIEW 6i. 2. Click the New VI button on the LabVIEW startup screen. 3. Create a LabVIEW VI as shown in Figure 4. Refer to the LabVIEW Online Help for assistance with creating this application. Do not associate the four LEDs with real-world I/O at this time. This operation is described in upcoming steps.

Figure 4. Application Front Panel and Block Diagram 4. Right-click on the Input 1 indicator and select Data Operations>>DataSocket Connection from the popup menu. 5. Click Browse in the DataSocket Connection dialog box and select Browse Measurement data from the popup menu. 6. Expand the directory tree structure as shown in Figure 5 and select item 100001 from the item list. Click Ok to continue.

Figure 5. Browsing for an Item 7. Click on Attach in the DataSocket Connection dialog box to complete the operation.

Figure 6. Completing the Attachment 8. Repeat steps 4 through 7 to attach Input 2, Output 1, and Output 2 to real-world I/O addresses. When attaching the Output LEDs, select Publish as the Connection Type in the DataSocket Connection dialog box. 9. The application is now ready to run. Click on the Start/Stop I/O Scan switch to switch it to the up position, and then click on the white run arrow icon to run the application. If successful, the onscreen LEDs illuminate as voltage is applied to the inputs and Boolean logic returns true for the outputs as shown in Figure 8.

Figure 7. Starting the Sample Application

Figure 8. Running the Sample Application.

S-ar putea să vă placă și