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.
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
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)
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
LabVIEW 8.5 FPGA Module Help
LabVIEW FPGA Module Release and Upgrade Notes
LabVIEW Microprocessor SDK 2.5 Documentation Resources
Complete the following steps to install the necessary software to support the LabVIEW Microprocessor SDK CompactRIO example target.
- Log on as an administrator or as a user with administrator privileges.
- Install LabVIEW 8.5.1, if not already installed.
- Install the LabVIEW Internet Toolkit for Windows, if not already installed.
- 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.
- Install the LabVIEW Embedded Development Module SDK 2.5.1.
- Install the LabVIEW Microprocessor SDK CompactRIO Example Target for LabVIEW 8.5.1.
- Install the gcc redistributable compiler.
- Unzip the gcc redistributable compiler zip file to a directory that does not contain spaces, such as c:\vxworks63gccdist.
- In the \supp subdirectory, edit setup-gcc.bat so that GCCPATH is the path where you installed gcc.
- 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.
- Download and install Python 2.5.1 for Windows.
- Add the location where you installed Python to the Windows path system variable.
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.
Complete the following steps to configure the CompactRIO target in Measurement & Automation Explorer (MAX) for use with the Microprocessor SDK.
- Select Start»All Programs»National Instruments»Measurement & Automation Explorer to open MAX
- Expand Remote Systems in the configuration tree.
- 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).
- Select the CompactRIO target in the configuration tree.
- Select Edit the IP settings.
- Enter the IP address for the CompactRIO target.
- Select Software in the configuration tree.
- Right-click and select Add/Remove Software from the shortcut menu to open the LabVIEW Real-Time Software Wizard.
- 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.
- Click the Yes button.
- 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.
The CompactRIO, VxWorks example target contains implementations of the following features:
On Chip Debugging
Pre-Built Run-Time Library
Static Memory Model
*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 on the CompactRIO target is the same as in the FPGA Module. The CompactRIO example target supports the following:
- FPGA Interrupts
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.
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.
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
- FPGA Interrupt VI
- In Place Element structure
- Modbus I/O server
- Real-Time Execution Trace Toolkit
- Real-Time System Manager
- RT Target Web Server
- Shared variables
- SoftMotion Development Module for LabVIEW
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.
- 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.
- Select Existing target or device to display the available embedded targets.
- Expand the Embedded folder.
Note: You must use the Embedded cRIO target instead of the Real-Time .
- Expand the VxWorks folder and select CompactRIO, VxWorks.
- Click the OK button. The embedded target appears in the Project Explorer window.
- 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.
- Expand the FPGA Target folder and select XXX. LabVIEW displays only valid FPGAs for the CompactRIO target.
- 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.
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.
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.
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.