Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
What is Developer Zone?
United States

Document TypeTutorial
NI Supported: Yes
Publish Date: Oct 18, 2012


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links -Products and Services

Connect LabVIEW to Any Industrial Network and PLC

35 Ratings | 3.14 out of 5
Read in  |  Print |  PDF

Overview

National Instruments Programmable Automation Controllers (PACs) and LabVIEW can add a wide variety of functionality to existing PLCs and industrial systems. Machine condition monitoring, high-speed analog measurements, and custom Vision applications are a few examples of typical PAC applications. Communication between the two systems is extremely important and must be simple, effective, and often times deterministic. This white paper will cover the different methods to connect LabVIEW and National Instruments PACs to any industrial network, device and PLC.

Table of Contents

  1. Basic Digital and Analog I/O
  2. Modbus TCP and Modbus Serial
  3. Plug-In Communication Boards

Basic Digital and Analog I/O

Perhaps the simplest way to integrate National Instruments PACs with existing PLCs is through basic Digital or Analog I/O. All National Instrument PAC platforms have digital I/O available. The minimum amount of digital I/O on a NI PAC platform is on the NI Compact Vision system. Compact Vision offers 15 digital inputs and 14 digital outputs. With digital I/O, you can communicate data through a variety of methods. The most basic method would be to toggle a single digital line, allowing you to send one bit of data for things such as status, or pass/fail. If you need to output more information, such as error codes, or large numbers, or to implement hand shaking, multiple digital I/O lines or ports can be used. With 8 digital I/O lines, you can read and write up to 256 distinct values. Finally, you can generate pulses across a digital line. Pulse generation can be used for precision timing and triggering of your automation devices, such as actuators and PLCs.

Analog I/O is also a good option for communication between an NI PAC and a PLC. With Analog I/O, you can send a much larger amount of data using a single line. With a 16-bit DAC, you could send thousands of distinct values across a single line. Analog I/O is good for sending incremental changes for a specific value and using minimal wires. One of the disadvantages of using Analog I/O for communication is the possibility of noise and signal integrity. If your PAC or PLC system is on the factory floor, there may be a lot of noise that could change the value of signal you are trying to read or write. Using isolated data acquisition products can help protect your data from ground loops, voltage spikes, and noisy environments.

Figure 1. NI CompactRIO and Allen-Bradley Control Logix Integration with Digital I/O

Related Links:

Modbus TCP and Modbus Serial

Modbus TCP and Modbus Serial are two of the most commonly used industrial protocols/networks on the market. NI LabVIEW 8.0 introduced native Modbus TCP and Modbus Serial support on any ethernet or serial port with two LabVIEW add-on modules: LabVIEW Real-Time and LabVIEW DSC.  Either of these modules allows you to create a Modbus TCP or Modbus Serial I/O server through a graphical configuration assistant. With just a few clicks of the mouse, you can create a Modbus Master or Slave and specify the different registers to read and write. The link below highlights the process of creating a Modbus I/O server with LabVIEW 8.

If you are using an older version of LabVIEW or do not have the LabVIEW Real-Time or DSC modules, you can use the LabVIEW Modbus Library, which provides a set of lower-level VIs to create Modbus Master or Slave applications with any ethernet of serial ports. To download this free library, use the following link.

Modbus TCP is also a useful tool for utilizing gateways for a large variety of connectivty options. For more information on this topic, please refer to the gateways section of this white paper.

Related Links:

Plug-In Communication Boards

When using a standard desktop computer or a PXI chassis, you can take advantage of the available PCI or PXI slots for plug-in communication boards. Some of the advantages of using plug-in boards include:

  • Direct communication with existing industrial networks, providing connectivity to all the connected components
  • Deterministic communication with the processor
  • High-level functions (API) for rapid application development

National Instruments offers plug-in communication boards for PCI, PXI, and PCMCIA for the following industrial networks; PROFIBUS, DeviceNet, CANopen, CAN, Serial (RS232, RS422, and RS485), and FOUNDATION Fieldbus. The following sections will cover the different types of plug-in communication boards.

PROFIBUS Interfaces

PROFIBUS was developed in 1989 and is one of the world’s most popular types of fieldbus. With over 20,000,000 installed nodes, PROFIBUS is most popular in Europe and is the standard for Siemens Automation PLCs to connect to one another, smart sensors, actuators and I/O. 

PXI PROFIBUS Interface 

Figure 2. PXI and PCI PROFIBUS intefaces from NI.

 

NI PROFIBUS PCI and PXI one-port interfaces connect PC-based controllers to PROFIBUS industrial networks as powerful masters or slaves. NI PROFIBUS interfaces include an NI LabVIEW driver for human machine interface (HMI) and SCADA applications. You can perform PROFIBUS device automated test using these interfaces. These interfaces ship with an easy-to-use VISA-based driver that works in LabVIEW and LabVIEW Real-Time. 

If you are using an NI PAC that does not have a PCI or PXI expansion slot, you can use a 3rd party gateway to connect LabVIEW to PROFIBUS networks and devices.

Related Links:

DeviceNet Interfaces

DeviceNet is commonly used in industrial applications and is a simple, open networking solution that allows up to 64 devices to communicate with each other an a single bus, reducing the cost and complexity of wiring and installing automation devices, and providing interoperability of similar components from various vendors. DeviceNet is based on the Controller Area Network (CAN) physical layer, and is a low-cost solution for connecting industrial devices, such as photoelectric sensors, bar code readers, I/O, industrial PCs, PLCs, displays, and human machine interfaces (HMIs) to a network. The direct connectivity provides improved communication between devices as well as device-level diagnostics not easily accessible or available through hard wired I/O interfaces.

National Instruments plug-in DeviceNet interfaces can function as both a master (scanner) or a slave. NI DeviceNet interfaces are offered in PCI, PXI, and PCMCIA form factors and use the industry standard 5-pin combicon connector for access to DeviceNet devices and networks. The PXI DeviceNet board is compatible with LabVIEW Real-Time for deterministic control and communication to DeviceNet networks and devices. All DeviceNet boards ship with NI-DNET driver software, which provides high-level, easy-to-use functions for rapid application development. In addition, NI-DNET offers two utilities for network setup and configuration; NI Configurator and Analyzer.

Figure 3.  National Instruments Plug-In DeviceNet Interfaces

National Instruments DeviceNet interfaces are a great solution for adding functionality to an existing DeviceNet network. For instance, if you want to add machine condition monitoring to monitor and protect your expensive equipment, you can use a PC or PXI chassis with NI LabVIEW and Dynamic Signal Acquisition boards to perform the machine monitoring and analysis. You could then pass pertinent information to the DeviceNet master (often a PLC) with an NI DeviceNet board in slave mode, integrating the two systems on a single network.

NI DeviceNet Configurator:  The Configurator is a powerful configuration tool with Electronic Data Sheet (EDS) support. Each DeviceNet device has its own EDS file, which is available from the device manufacturer. The Configurator can search a DeviceNet network to determine information about connected devices, load the related EDS files automatically, read and write the device parameters, and change a device MAC ID.

NI DeviceNet Analyzer:  The Analyzer monitors the DeviceNet network and interprets the captured CAN messages according to the DeviceNet protocol. It displays the messages together with their parameters. You can display certain types of messages using powerful filters and find options. You also can get the message statistics in the Analyzer. The Analyzer is useful for troubleshooting and analysis of DeviceNet networks and systems.

If you are using an NI PAC that does not have an available plug-in DeviceNet board, you can use a 3rd party gateway to connect LabVIEW to a DeviceNet network or device. Please refer to the 3rd Party Gateway section below for more information.

Related Links:

CANopen Interfaces

CANopen is a higher-level protocol based on the CAN physical layer and was developed as a standardized embedded network with highly flexible configuration capabilities. Originally designed for motion control applications, the CANopen protocol is common in many industry segments including medical equipment, off-road vehicles, public transportation and building automation.

For CANopen master functionality, National Instruments offers the CANopen LabVIEW Library, which provides high-level, easy-to-use NI LabVIEW functions to create CANopen master applications. Because the CANopen functions work on top of NI-CAN driver software, all high-speed National Instruments Series 2 CAN devices for PCI, PXI, and PCMCIA can operate as fully functional CANopen master interfaces.

Figure 4.  National Instruments CANopen Interfaces

The NI CANopen LabVIEW Library provides functionality that covers the entire spectrum of CANopen master applications, including transmitting and receiving service data objects (SDOs) and process data objects (PDOs), network management, heartbeat and node guarding, emergencies, and synchronization objects. With these functions, you can create applications that fully adhere to the CAN in Automation (CiA) DS310 standard.

The CANopen LabVIEW Library also works with the NI SoftMotion Controller for CANopen motion drives, helping engineers easily add any CANopen I/O onto their motion CANopen networks. The NI SoftMotion Controller is a soft motion engine that helps engineers interface between NI-Motion driver software and distributed intelligent drives. Engineers now can program CANopen-based Accelnet and Xenus drives from Copley with the easy-to-use NI-Motion API in LabVIEW.

If you are using an NI PAC that does not have an available plug-in CANopen board, you can use a 3rd party gateway to connect LabVIEW to CANopen networks and devices.  Please refer to the 3rd Party Gateway section below for more information.

Related Links:

Serial (RS232, RS422, and RS485) Interfaces

Serial is a device communication protocol that is standard on almost every PC. Most desktop and laptop computers include one or more RS232 based serial ports. Serial is also a common communication protocol for instrumentation in many devices, and numerous GPIB-compatible devices come with an RS232 port. Furthermore, you can use serial communication for data acquisition in conjunction with a remote sampling device. While RS232 is the most common serial protocol, RS422 and RS485 are also commonly used serial protocols.

National Instruments Serial Overview:  National Instruments  is a market leader for instrument control and offers a complete product offering of Serial interfaces for RS232, RS422, and RS485 protocols. NI offers Serial interfaces on a wide variety of computer buses, providing interfaces for PCI, PXI, PCMCIA, ExpressCard/34, USB and Ethernet. All National Instruments Serial interfaces are plug-and-play compatible and are completely software-configurable. In addition, NI Serial hardware and software offer features such as flexible baud rates, hardware flow-control, and the PCI and PXI serial interfaces have minimal CPU utilization through DMA transfers and are available with in optional 2000 V port-to-port isolation.

Figure 5.  National Instruments Serial Interfaces

Related Links:

OPC

OLE for Process Control (OPC) is the original name for a standard developed in 1996 by an industrial automation industry task force. The standard specified the communication of real-time plant data between control devices from different manufacturers. The standard is now maintained by the OPC Foundation and has been renamed the OPC Data Access standard. The current version of the OPC Data Access specification is OPC Data Access 3.0.

OPC was designed to bridge Windows based applications and process control hardware and software applications. It is an open standard that permits a consistent method of accessing field data from plant floor devices. This method remains the same regardless of the type and source of data. Traditionally, any time a software package needed access data from a device, a custom interface, or driver, had to be written. The purpose of OPC is to define a common interface that is written once and then reused by company, SCADA, HMI, or custom software packages.

Figure 6. OPC is designed to improve enterprise system connectivity

Once an OPC server is written for a particular device, it can be reused by any application that is able to act as an OPC client. OPC servers use Microsoft’s OLE technology (also known as the Component Object Model, or COM) to communicate with clients.

LabVIEW as an OPC Server:  With LabVIEW 8 and later, you can publish any data that you have to a native OPC server using the shared variable. Using this method, you can publish any data that you have in LabVIEW to any application that can act as an OPC Client.

Adding OPC Client Functinoality to LabVIEW:  The LabVIEW Datalogging and Supervisory Control (DSC) Module extends the LabVIEW graphical development environment with additional functionality for the rapid development of distributed measurement, control, and high-channel-count monitoring applications. The DSC Module provides tools to the LabVIEW environment, making it easy to graph historical or real-time trends, enhance the security of front panels, log data automatically; and add alarming, scaling, and security to the shared variable. In addition, one of the biggest features that the LabVIEW DSC module provides, is the ability for LabVIEW to function as an OPC client, providing easy connectivity to any server implementing the OPC Foundation OPC server interface. The DSC Module finds all OPC servers installed on the computer and reads any available information about the server capabilities and items directly from the server. For more information about the LabVIEW DSC module, please refer to the following link.

Publishing Data from NI Data Acquisition (DAQ) Devices with an OPC Server:  While the LabVIEW DSC Module is required to add OPC client functionality to LabVIEW, NI-DAQmx driver software provides the ability to pulish data from any National Insturments DAQ device with a native OPC server, simplifying the creation of distributed data acquistion and control applications. All NI-DAQmx devices are available for use with the LabVIEW 8 shared variable engine through versions of NI-DAQmx 8 and later. To learn more about this functionality, please refer to the linked document below.

Publishing Data from NI Fieldpoint and Compact FieldPoint with an OPC Server:  Similar to NI-DAQmx, the FieldPoint driver software also contains an OPC server that allows you to publish your data to any OPC client. The FieldPoint OPC server conforms to the OPC Data Access 2.0 standard and like the other FieldPoint interfaces, imports the I/O Items that you configured in FieldPoint Explorer and makes them available as OPC Items to any OPC client. Therefore, if two computers are networked together, it is possible for an OPC client on one computer to access FieldPoint hardware connected to the OPC server on another computer.

Related Links:

3rd Party Gateways 

Any computer or NI programmable automation controller (PAC) with an Ethernet or serial port can communicate with PLCs, smart sensors, and actuators on a large variety of industrial networks by using third-party gateways. With the native Modbus capablilities introduced in LabVIEW 8 with either the DSC or Real-Time modules or with the Modbus library for National Instruments LabVIEW you can use any Ethernet or serial port as a Modbus TCP or Modbus serial master or slave. Using this library and any Modbus to protocol gateway, you can easily communicate with existing equipment on any industrial network to your LabVIEW application.

Figure 7.  3rd Party Gateways from HMS, Hilscher, and Woodhead

 

35 Ratings | 3.14 out of 5
Read in  |  Print |  PDF

Reader Comments | Submit a comment »


This document has no options for the Analog Input . It should be mentioned here...
- May 25, 2010


Inaccurate really? These guys did it: http://www.embeddeddesignindia.co.in/S TATIC/PDF/200808/EDIOL_2008AUG06_ MCP_TA_03.pdf? SOURCES=DOWNLOAD "The third CompactRIO system takes the thickness measurements from the other two systems and performs an analogue output measurement to the PLCs that are controlling the rolling mills"
- Jan 19, 2009

inaccurate and misleading
"Analog I/O is also a good option for communication between an NI PAC and a PLC" Seriously ?!? This is clearly written by someone with no practical experience, and thus is no help in real world applications.
- May 31, 2008

Nice
Way to go!
- ghelm@ahde.com - Dec 21, 2006

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).