LabVIEW Microprocessor SDK CompactRIO Example Target

Publish Date: Jun 13, 2008 | 2 Ratings | 2.50 out of 5 |  PDF

Overview

Note: This example target is intended for use with LabVIEW 8.5.1 and LabVIEW Microprocessor SDK 2.5.1. The National Instruments CompactRIO is an advanced embedded control and data acquisition system designed for applications that require high performance and reliability. CompactRIO combines an embedded real-time processor, a high-performance FPGA, and hot-swappable I/O modules. Each I/O module is connected directly to the FPGA, providing low-level customization of timing and I/O signal processing. The FPGA is connected to the embedded real-time processor via a high-speed PCI bus. This represents a low-cost architecture with open access to low-level hardware resources. LabVIEW contains built-in data transfer mechanisms to pass data from the I/O modules to the FPGA and also from the FPGA to the embedded processor for real-time analysis, post-processing, data logging, or communication to a networked host computer.

The LabVIEW Microprocessor SDK allows users to incorporate a third-party C toolchain to target any 32-bit microprocessor technology. As an example, National Instruments has developed an implementation for the Freescale MPC5200 PowerPC processor used in the NI CompactRIO real-time controller. This example leverages the GCC compiler for Wind River VxWorks to compile LabVIEW-generated C code to an executable module that can run on the CompactRIO.

Benefits of using the LabVIEW Microprocessor SDK are as follows:
  • Easily incorporate large amounts of C code with the Inline C Node
  • Increase code density by taking advantage of LabVIEW C Generator dead-stripping
  • Increase software reuse from CompactRIO prototyping platform to custom deployment target

Table of Contents

This CompactRIO target is an example target you can use with the LabVIEW Microprocessor SDK. The example target is compatible with NI cRIO-9012 and NI cRIO-9014 running VxWorks.

Contents

System Requirements
Related Documentation
Installation
Uninstalling
Configuring the CompactRIO Target
Microprocessor SDK Implemented Features
Differences between the CompactRIO Target in the LabVIEW Microprocessor SDK and the LabVIEW Real-Time Module
Programming the FPGA
Additional Features with Microprocessor SDK
Porting an Existing Real-Time Application to the Microprocessor SDK
Unsupported Real-Time Features
Adding the CompactRIO Example Target to a LabVIEW Project
Creating CompactRIO Build Specifications
Building CompactRIO Applications
Debugging CompactRIO Applications
Related Links

System Requirements

To use the CompactRIO example target with the LabVIEW Microprocessor SDK, you must have the following in addition to the hardware:

  • A computer with Windows Vista/XP/2000
  • LabVIEW 8.5.1 Full or Professional Edition
  • LabVIEW Internet Toolkit for Windows
  • LabVIEW FPGA Module 8.5.1
  • NI-RIO 2.4 (included with the FPGA Module)
  • LabVIEW Embedded Development Module 2.5.1 (now called LabVIEW Microprocessor SDK)
  • gcc redistributable compiler 6.3: vxworks63gccdist.zip
  • Python 2.5.1 for Windows (available for download from www.python.org)

Related Documentation

Refer to the following documentation for more information about various components of the CompactRIO SDK example target:

CompactRIO cRIO-9012/9014 Operating Instructions and Specifications

http://digital.ni.com/manuals.nsf/websearch/7550849022D8AC21862572D800669C23

 LabVIEW 8.5 FPGA Module Help

http://digital.ni.com/manuals.nsf/websearch/16B5B935E3EE70828625732B0057CF75

LabVIEW FPGA Module Release and Upgrade Notes

http://digital.ni.com/manuals.nsf/websearch/E0D1EB2856423066862572EB007287A0

LabVIEW Microprocessor SDK 2.5 Documentation Resources

http://digital.ni.com/public.nsf/allkb/2F84D20969E3D41386257325006F5FF9

Installation

Complete the following steps to install the necessary software to support the LabVIEW Microprocessor SDK CompactRIO example target.

  1. Log on as an administrator or as a user with administrator privileges.
  2. Install LabVIEW 8.5.1, if not already installed.
  3. Install the LabVIEW Internet Toolkit for Windows, if not already installed.
  4. Install the LabVIEW FPGA Module 8.5.1 from the first LabVIEW FPGA Module 8.5.1 installation CD, if not already installed. Insert the second CD when prompted to install NI-RIO.
    Note: The Real-Time and Embedded item in the installer is not the same as the LabVIEW Embedded Development Module.
  5. Install the LabVIEW Embedded Development Module SDK 2.5.1.
  6. Install the LabVIEW Microprocessor SDK CompactRIO Example Target for LabVIEW 8.5.1.
  7. Install the gcc redistributable compiler.
    1. Unzip the gcc redistributable compiler zip file to a directory that does not contain spaces, such as c:\vxworks63gccdist.
    2. In the \supp subdirectory, edit setup-gcc.bat so that GCCPATH is the path where you installed gcc.
    3. Run setup-gcc.bat in a command shell to enable use of the toolchain and GNU utilities Wind River distributes in their version of gcc.
  8. Download and install Python 2.5.1 for Windows.
  9. Add the location where you installed Python to the Windows path system variable.

Uninstalling

We replace a small subset of NI-RIO files to make the CompactRIO target compatible with the LabVIEW Microprocessor SDK. If you uninstall the Microprocessor SDK CompactRIO example target, you must repair your NI-RIO installation. Likewise, if you reinstall NI-RIO after you install the Microprocessor SDK example target, you must repair your LabVIEW Microprocessor SDK CompactRIO installation.

Configuring the CompactRIO Target

Complete the following steps to configure the CompactRIO target in Measurement & Automation Explorer (MAX) for use with the Microprocessor SDK.

  1. Select Start»All Programs»National Instruments»Measurement & Automation Explorer to open MAX
  2. Expand Remote Systems in the configuration tree.
  3. Set the IP address in MAX if you have not previously configured the CompactRIO target with an IP address (or if you have reformatted the target hard drive).
    1. Select the CompactRIO target in the configuration tree.
    2. Select Edit the IP settings.
    3. Enter the IP address for the CompactRIO target.
  4. Select Software in the configuration tree.
  5. Right-click and select Add/Remove Software from the shortcut menu to open the LabVIEW Real-Time Software Wizard.
  6. Select Custom software installation and click the Next button. A warning about recommended software sets appears because this software does not natively install with the LabVIEW Real-Time Module.
  7. Click the Yes button.
  8. Select the icon next to LabVIEW Microprocessor SDK Example 1.0 and select Install this feature.

Refer to the Installing a Custom Software Selection topic in the MAX Remote Systems Help, which is available by clicking the Help button in the wizard for more information about downloading and installing custom software features using the LabVIEW Real-Time Software Wizard.

Tip: Set the CONSOLE OUT jumper on the CompactRIO target to ON to redirect standard output (stdout) to the serial port.

Microprocessor SDK Implemented Features

The CompactRIO, VxWorks example target contains implementations of the following features:

Target Name

Instrumented Debugging

On Chip Debugging

Pre-Built Run-Time Library

Static Memory Model

Memory Mapping

Elemental I/O

 IDE Integration

CompactRIO, VxWorks

TCP

No

Yes

Yes

No

No*

No

*The CompactRIO example target uses FPGA I/O instead of Elemental I/O.

Differences between the CompactRIO Target in the LabVIEW Microprocessor SDK and the LabVIEW Real-Time Module

Depending on the application, programming the CompactRIO target in the Microprocessor SDK might be slightly different than what you are familiar with in the Real-Time Module.

 Programming the FPGA

Programming the FPGA on the CompactRIO target is the same as in the FPGA Module. The CompactRIO example target supports the following:

  • DMA
  • Ethernet
  • FPGA Interrupts

Additional Features with Microprocessor SDK

The Microprocessor SDK adds the following features, which can give you more control and optimization for your application:

  • Inline C Node—Use the Inline C Node to add C code or assembly code, including assembly directives and #defines to the block diagram. The Inline C Node is similar to the Formula Node with additional support and functionality for low-level programming and header files without the overhead of a function call. Unlike calling external C code, code in the Inline C Node is compiled in the LabVIEW application.
  • Build settings—Define build settings to optimize and generate C code for your specific application. You can define these settings on a per-application or per-VI basis.
    • Memory Options: Select between small, which allocates and frees memory as soon as possible, or static, which declares all variables as static and allocated prior to the main entry point.
    • Use stack variables: You can use stack variables rather than heap variables to represent signals in the generated code, which enables better C compiler optimizations and makes the C code faster. You must use this option with the Generate serial only option.
    • Generate serial only: Generates C code without cooperative multitasking code, which usually makes the C code easier to read. However, you lose parallel execution behavior.
    • Generate guard code: Generates extra code to prevent common coding mistakes. Guard code makes an embedded application slightly larger and slower.
    • Generate C function calls: Generates the calling interface to all VIs as C function calls without any data initializations. An error occurs if any input or output to any VI is unwired when you build the application. You must use this option with the Generate serial only option.
    • Expression folding: Generates better performing and more efficient code by collapsing groups of nodes into single expressions. You cannot debug an application while using expression folding because this option eliminates some of the wires in the generated C code.
    • Build configuration: Select between debug mode, which applies no compiler optimizations and allows for C source-level debugging, and release mode, which applies compiler optimizations.
    • Generate debug info: Adds extra code you need to debug the application. This extra code is in the form of C function calls that update the application state and communicate the state to the host computer for display.

Porting an Existing Real-Time Application to the Microprocessor SDK

You must make the following changes to port an existing Real-Time CompactRIO application to the Microprocessor SDK:

  • The CompactRIO example target in the Microprocessor SDK uses the Real-Time FIFO VIs instead of the Real-Time FIFO functions.
  • VISA is unsupported. Use the Serial Compatibility VIs instead.
  • Timed Loops are supported differently. The Configure Timed Loop dialog box contains only those options the SDK supports.

Unsupported Real-Time Features

The following features are unsupported when you use the CompactRIO example target with the Microprocessor SDK:

  • Any VIs, functions, or utilities that are shipped exclusively with the LabVIEW Real-Time Module
  • Datasocket
  • FPGA Interrupt VI
  • FTP
  • In Place Element structure
  • Modbus I/O server
  • Profiling
  • Real-Time Execution Trace Toolkit
  • Real-Time System Manager
  • RT Target Web Server
  • Shared variables
  • SoftMotion Development Module for LabVIEW
  • NI-CAN
  • NI-IrDA
  • NI-Serial
  • NI-Visa

Adding the CompactRIO Example Target to a LabVIEW Project

You must create a LabVIEW project before you can create an application using the CompactRIO example target. You then add the target to the project and develop the VIs for the application.

Complete the following steps to add the CompactRIO example target to a project.

  1. Right-click the project in the Project Explorer window and select  New»Targets and Devices from the shortcut menu to display the Add Targets and Devices dialog box.
  2. Select Existing target or device to display the available embedded targets.
  3. Expand the Embedded folder.
    Note: You must use the Embedded cRIO target instead of the Real-Time .
  4. Expand the VxWorks folder and select CompactRIO, VxWorks.
  5. Click the OK button. The embedded target appears in the Project Explorer window.
  6. If you are programming the FPGA on the CompactRIO target, right-click the CompactRIO target and select New»Targets and Devices from the shortcut menu to display the Add Targets and Devices dialog box.
  7. Expand the FPGA Target folder and select XXX. LabVIEW displays only valid FPGAs for the CompactRIO target.
  8. Click the OK button. The FPGA target appears under the CompactRIO target in the Project Explorer window.

Setting the IP Address / DNS Name

You must set the IP address or DNS name for the CompactRIO target before you can communicate with it in LabVIEW. The IP address is the same IP address as in MAX. To set the IP address or DNS name, right-click the target in the Project Explorer window and select Properties from the shortcut menu. You also must enter or browse to the path where you installed the gcc redistributable compiler.

Creating CompactRIO Build Specifications

You must create a build specification to define how the LabVIEW C Code Generator, which is part of the SDK, generates the C code. When you are ready to build the application, right-click the build specification and select Build from the shortcut menu.

Building CompactRIO Applications

After you develop the VI on the host computer and create a CompactRIO target build specification, you build the VI into an executable CompactRIO application that you can deploy and run on the CompactRIO target.

When you build a CompactRIO application in the LabVIEW Microprocessor SDK, LabVIEW compiles the FPGA VI to a bitfile. The LabVIEW C Code Generator, which is part of the Microprocessor SDK, takes the bitfile, any non-FPGA VIs, and any external files and generates C code. The .out is in the destination directory you specify in the build specification.

Debugging CompactRIO Applications

CompactRIO applications the LabVIEW C Code Generator generates support instrumented debugging. With instrumented debugging, the LabVIEW C Code Generator includes additional data structures and function calls to synchronize with LabVIEW and uses TCP as a debug channel.

To debug an embedded application, you must select the Debug build configuration and place a checkmark in the Generate debug info checkbox in the Application Information page of the Build Specifications Properties dialog box. Using the Debug build configuration does not apply any compiler optimizations, which makes the application larger in size. Generating debugging information adds extra code you need to debug the application. The extra code is in the form of C function calls that update the application state and communicate the state to the host computer for display.

Generating debugging information usually results in a 25%-40% increase in code size, as well as a decrease in execution speed because the application sends all front panel updates to the host.

Unlike the Real-Time Module, data is not sent from the target back to the host PC just by clicking the Run button in the Microprocessor SDK. You must explicitly build the cRIO application with debugging enabled.

Related Links

CompactRIO Advisor

http://ohm.ni.com/advisors/crio?nidna=5988&lang=US

Back to Top

Bookmark & Share

Downloads

Attachments:

mpucrio.exe

Ratings

Rate this document

Answered Your Question?
Yes No

Submit