Programming for the LabVIEW Real-Time Module Using LabWindows/CVI

Similar documents
LabVIEW Real-Time Module for Mac OS X User Manual Addendum

NI-Industrial Communications for EtherCAT

LabVIEW Real-Time Module Release Notes

IMAQ Vision Deployment Engine Note to Users

IMAQ Vision Deployment Engine Note to Users

Getting Started with the LabWindows /CVI Real-Time Module

LabVIEW Real-Time Module Release and Upgrade Notes

Getting Started with the LabVIEW Real-Time Module

LabVIEW FPGA Module Release and Upgrade Notes

Academic Software Solutions

LabVIEW for FTC Release Notes

NI-DAQ mx Base 1.x. Contents GETTING STARTED GUIDE

LabVIEW Application Builder User Guide

Where to Start with NI ELVIS

LABVIEW REAL-TIME. Contents. About LabVIEW Real-Time (RT) RELEASE NOTES. Version 6.1

NI VeriStand Model Framework

Using Desktop PCs as RT Targets with the LabVIEW Real-Time Module

Getting Started with the LabVIEW Real-Time Module

LabWindows /CVI Release Notes Version 8.0.1

LabWindows /CVI Release Notes

Contents. Getting Started. RELEASE NOTES TestStand ATML Toolkit Version 2017

Developing Measurement and Control Applications with the LabVIEW FPGA Pioneer System

Getting Results with CompactRIO and LabVIEW

Where to Start with NI ELVIS

NI-DAQ mx for USB Devices

LabWindows /CVI Release Notes Version 9.0

LabWindows /CVI Version 2017

NI TestStand ATML Toolkit Version 2013

LabVIEW Datalogging and Supervisory Control Module

LabVIEW DataFinder Toolkit

Tips for Code Re-Use. Rejwan Ali, Marketing Engineer NI Africa and Oceania

NI PXI Installing the NI PXI-8104 INSTALLATION GUIDE

NI USB-6211/6218 OEM

Answers to Frequently Asked Questions about NI-DAQmx and Traditional NI-DAQ (Legacy)

LabVIEW FPGA Module Release Notes

LabVIEW Release Notes

IMAQ Vision 7 Development Module for LabVIEW Release Notes

LabVIEW VI Analyzer Toolkit

LabWindows /CVI Version 2015

LabWindows /CVI Release Notes Version 2010

NI TestStand ATML Toolkit

Getting Started with the LabVIEW Robotics Module Version 2011

Sample. LabWindows TM /CVI TM Core 1 Course Manual

ESERIES CALIBRATION FIXTURE INSTALLATION GUIDE

Getting Started with the LabVIEW Datalogging and Supervisory Control Module

TestStand. Contents RELEASE NOTES. Version 2017

Hardware: Acquiring Data and Communicating with Instruments

LabVIEW FPGA Module Version 2013

LabVIEW PDA Module Release Notes

Sample. LabWindows TM /CVI TM Core 1 Exercises Manual

LabVIEW Graphical Development Platform. Part I An Open Platform for Long-Term Continuity

PXI and PXI Express Chassis Fan Replacement

The NI TB-2648/2649/2650/2651 terminal blocks configure your NI PXI/PXIe-2531 (NI 2531) in one of the following topologies. 1-wire 8 64 matrix

NI WSN-9791 Ethernet Gateway

GETTING STARTED NI 9501 C Series Stepper Drive Modules and NI SoftMotion Module

LabVIEW VI Analyzer Toolkit

INSTALLATION INSTRUCTIONS Data Management Software Suite in the Evaluation Mode

NI TestStand ATML Toolkit

Getting Started with the NI 783x R

LabWindows /CVI Release Notes Version 2009

LabVIEW Express VI Development Toolkit User Guide

Software-Defined Test Fundamentals. Understanding the Architecture of Modular, High-Performance Test Systems

Install the Software and Hardware

LabVIEW Real-Time Module Release and Upgrade Notes

IVI Compliance Package Release Notes

LabVIEW TM Real-Time 2: Architecting Embedded Systems Exercises

With respect to the National Instruments software product(s) being used, the following patents may apply:

Getting Started with the LabVIEW Datalogging and Supervisory Control Module

LabVIEW FPGA Module Release and Upgrade Notes

ECU Measurement and Calibration in a Real-Time Test Environment. Roland Magolei National Instruments Engineering GmbH Embedded Networks

USER MANUAL NI 9755 NI Powertrain Controls CompactRIO NOx Sensor Module Kit

LabVIEW Release Notes

ni.com/training Quizzes LabVIEW Core 1 ni.com/training Courses Skills learned: LabVIEW environment Certifications Skills tested: LabVIEW environment

8x16, 2-Wire Terminal Block for the NI PXI The following conventions are used in this guide:

NI Contents. Hardware Overview INSTALLATION GUIDE. NI 8221 Features

LabWindows /CVI Version 2013

INSTALLATION INSTRUCTIONS Data Management Software Suite

CALIBRATION PROCEDURE SCXI Contents. Software Requirements. ni.com/manuals

Electromagnetic Compatibility Guidelines

GETTING STARTED GUIDE

Foundation Fieldbus Hardware and NI-FBUS Software for Windows 2000/XP

NI 6703/6704 Calibration Procedure for NI-DAQ mx

NOTE TO USERS NI 61xx Pinout Labels for the SCB-68 Multifunction I/O S Series Modules/Devices Using the 68-Pin Shielded Connector Block

Introduction to LabVIEW and NI Hardware Platform

Related Information Refer to the NI Switches Help for detailed information about features and programming options for your NI switch product.

PXI. NI-Sync User Manual. NI-Sync User Manual. October C-01

The following conventions appear in this document:

NI-DAQmx Basic Course NITS John Shannon

PCI/PXI Gigabit Ethernet Adapters

NI 6703/6704 Calibration Procedure for Traditional NI-DAQ

Measurement Studio Measurement Computing Edition

INSTALLATION INSTRUCTIONS Data Management Software Suite

Copyright, Data Science Automation, Inc. All Rights Reserved. Page 1 of 5

CALIBRATION PROCEDURE PXIe channel, 16-bit, 400 ks/s/ch, Ch-Ch Isolated Analog Input Module. ni.com/manuals

CALIBRATION PROCEDURE NI PXIe Channel, Isolated Voltage/Current Analog Output Module

M Series USB-6221/6225/6229/6251/6255/6259 OEM Devices

Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Analysis

CALIBRATION PROCEDURE CAL Contents. Software

Analytical Instrumentation

Contents. Software CALIBRATION PROCEDURE NI TC-4353

Transcription:

Application Note 182 Programming for the LabVIEW Real-Time Module Using LabWindows/CVI Introduction This document discusses using LabWindows/CVI to interface with RT Series hardware and to write DLLs to use in LabVIEW VIs for downloading onto an RT device. What Is the LabVIEW Real-Time Module? The LabVIEW Real-Time Module is a LabVIEW add-on that downloads LabVIEW applications onto embedded hardware for deterministic real-time performance. You can debug these applications using the traditional LabVIEW development environment under Windows and then download the applications to run under a real-time operating system embedded on RT Series processor-based measurement hardware. How Does LabWindows/CVI Extend This Capability? LabWindows/CVI extends the real-time functionality of LabVIEW to C programmers in two ways. First, LabWindows/CVI offers programmatic access to the shared memory of an RT Series Plug-In DAQ device through reading and writing functions. Second, in LabWindows/CVI you can build DLLs that can be downloaded and run on any RT Series device. Note In both cases, you must have the LabVIEW Real-Time Module installed on the machine being used. For accessing shared memory, no knowledge of LabVIEW is required. However, using a DLL for downloading to a device requires the LabVIEW development environment. Accessing Shared Memory The cvirtsup.fp driver, located in the toolslib\cvirtsup directory, contains the functionality for accessing the shared memory of an RT Series DAQ device. You can use the functions to read and write data to and from the shared memory of the RT Series DAQ device defined in the device field. This device number is the number used by Measurement & Automation Explorer (MAX) to refer to the device. Reading and writing data to the shared memory, you can pass information between programs running on the RT Series DAQ device and those running on the host computer. When you use LabWindows/CVI and the cvirtsup.fp functions to access the shared memory, note that C code is not actually downloaded to the device itself. Only the shared memory is accessed. Refer to lvrtsamp.prj in samples\cvirtsup for an example. LabVIEW, National Instruments, and ni.com are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies. For patents covering National Instruments products, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your CD, or ni.com/patents. 342227A-01 2002 National Instruments Corporation. All rights reserved. January 2002

LabWindows/CVI LabVIEW Real-Time Support Engine LabWindows/CVI has three different versions of its run-time engine: Standard Run-Time Engine, which handles all LabWindows/CVI functionality Instrument Support Engine, which removes much of the UI capabilities of LabWindows/CVI, but retains most of the remaining functionality LabVIEW Real-Time Support Engine, which provides the functionality of the embedded RT Series devices. When you design a DLL in LabWindows/CVI to use in a real-time LabVIEW application, build the DLL with this engine to ensure that your final DLL is compatible with the LabVIEW Real-Time Module and can be downloaded and executed on an RT Series device. Creating DLLs for Use with the LabVIEW Real-Time Module You can use LabWindows/CVI DLLs with the LabVIEW Real-Time Module in two ways: Use legacy C code and update the code to compile and link using the LabWindows/CVI LabVIEW Real-Time Support Engine instead of rewriting the code in LabVIEW. Write portions of your application in LabWindows/CVI, compile, and link the code into a DLL using the LabWindows/CVI LabVIEW Real-Time Support Engine. In both cases, you can then use the Call Library Function Node in LabVIEW to link your DLL into a downloadable LabVIEW application. Building a LabWindows/CVI DLL for the LabVIEW Real-Time Module Once you design and implement the code for the DLL, you can create a DLL by setting the Build»Target Type to Dynamic Link Library and switching the Runtime Support field of the Target Settings dialog box to LabVIEW Real-Time Only. You can leave all other fields in their default state. Click the Help button for more information on building a DLL. Refer to lvrt_vi.prj in samples\cvirtsup for an example. Using Your DLL with the LabVIEW Real-Time Module In a real-time LabVIEW application, you can use a Call Library Function Node in LabVIEW to access functions exported by the DLL. Call Library Function Node You can use a Call Library Function Node, an element of LabVIEW, to make calls to exported DLL functions. You can use a Call Library Function Node, which accepts a large number of data types and calling conventions, to call functions from most standard and custom libraries. Under Windows, you can call a DLL function directly. Under Mac OS and UNIX, you can call a shared library function directly. In setting up a Call Library Function Node, you specify the input and output parameters, data types, and return value. With your specifications, you can pass data and error information between LabVIEW and the DLL. For more information about using a Call Library Function Node, refer to LabVIEW Help. Application Note 182 2 ni.com

Downloading a LabVIEW Real-Time Module Application to an RT Series Device After creating your LabVIEW Real-Time Module application and using Call Library Function Nodes to reference your DLL, you are ready to download the program onto the RT Series device. To download your LabVIEW Real-Time Module application, you must have an RT Series device either installed on your computer or connected accross the network. In LabVIEW, select Operation»Switch Execution Target, and change the execution target to be your RT Series device. After resetting LabVIEW, select Operate»Download Application to download the LabVIEW application and all DLLs linked to it through Call Library Function Nodes. Once you download your application, you can execute it as you do other LabVIEW applications, although your application is running on the RT Series device and not on the host computer. For more information about downloading LabVIEW Real-Time Module applications and their execution on an RT Series device, please refer to the LabVIEW Real-Time Help. Debugging under the LabVIEW Real-Time Module The LabVIEW Real-Time Module has the standard debugging features of LabVIEW but cannot step inside the code of Call Library Function Nodes. Under LabWindows/CVI, DLLs created using the LabVIEW Real-Time Support Engine do not contain debugging information, because the user protection features required to debug an application in LabWindows/CVI cannot execute in an embedded RT Series device. National Instruments recommends that you debug your LabWindows/CVI DLLs prior to creating your final DLLs for the LabVIEW Real-Time Module. An alternative to step-through debugging is to put return error codes and/or return error strings in the interface to the functions exported from the DLL. You can check these return values for error messages to determine where an error might have occurred and how to fix it. LabWindows/CVI Functionality in the LabVIEW Real-Time Module LabWindows/CVI Run-Time Libraries LabWindows/CVI restricts its available functionality to what is compatible with the real-time operating system on embedded RT Series devices. The LabWindows/CVI LabVIEW Real-Time Support Engine 6.0 supports a subset of ANSI C, Formatting and I/O, and Utility Library functions. LabWindows/CVI also has libraries, such as the NI-DAQ library, which are compatible with RT Series devices. Other libraries, such as Easy I/O library and the LabWindows/CVI User Interface (UI) library, are not applicable on RT Series devices. For a complete list of the ANSI C, Formatting and I/O, and Utility Library functions exported by LabWindows/CVI for use with the LabVIEW Real-Time Module, type cvi_lvrt.dll in the index tab of the LabWindows/CVI Help. National Instruments Corporation 3 Application Note 182

DAQ Functionality The LabWindows/CVI development environment offers the data acquisition and easy I/O for DAQ libraries. Currently, only the function calls from the LabWindows/CVI data acquisition library are available to the LabVIEW Real-Time Module. Function calls from the easy I/O for DAQ library are not available. PID Functionality The PID toolkit also is available for use in the LabVIEW Real-Time Module. Interfaces between the LabVIEW Real-Time Module, LabWindows/CVI, and Remote Computers LabWindows/CVI Applications for Use with RT Series Devices A LabWindows/CVI program can exchange data between a host PC and a RT Series DAQ device using the shared memory and the functions contained in the cvirtsup.fp instrument driver. Data can be written to and read from the shared memory and the data received can be used within the LabWindows/CVI application. No restrictions exist on communication between your LabWindows/CVI program and other applications. You can transmit any data received from the shared memory of the RT Series device to other applications using any of the communication protocols available in LabWindows/CVI. Also, because the program is not actually running on the RT Series device, you can continue to use the UI Library panels. Real-Time LabVIEW Applications Using LabWindows/CVI DLLs You can pass data to and from the DLL using the function parameters and return values of the functions called using a Call Library Function Node. You can transfer this data, once returned to LabVIEW, to other applications and remote computers using LabVIEW data transfer protocols. You also can use LabVIEW User Interface front panels to show data. You can implement Ethernet connections between RT Series devices on the same network using the LabVIEW TCP/IP interfaces. You can find examples of how to use these interfaces in examples\rt directory. Currently, DataSocket and UDP are not available for embedded RT Series devices. Hardware and Controllers for Real-Time Applications LabVIEW Real-Time systems can incorporate DAQ, CAN, Serial, Motion, and DSA devices but not Instrument devices. For a detailed list, refer to the LabVIEW Real-Time Help. LabVIEW Real-Time systems support the following PXI RT Series controllers: PXI 8145 RT, PXI 8146 RT, PXI 8156B RT, PXI 8170 RT, PXI 8175 RT, and PXI 8176 RT. Performance Comparisons While running on the embedded RT Series device, a real-time LabVIEW application performs function calls to DLLs loaded in the memory of the RT Series device. Therefore, function calls to LabWindows/CVI DLLs are equivalent to calls to LabVIEW VIs, yielding no decrease in performance. Application Note 182 4 ni.com

Examples You can find LabWindows/CVI examples of the shared memory access and DLL creation for use in a LabVIEW real-time application in the samples\cvirtsup directory. You can find real-time examples of Ethernet, TCP/IP connections, and PID and DAQ controls in the examples\rt directory. National Instruments Corporation 5 Application Note 182

*342227A-01* 342227A-01 Jan02