Quickstart Guide
Introduction RIO Academic RIO Application examples Your first RT app Your first FPGA app
Basic procedures System admin File system I/O monitor System controller architecture Timed loops Inter-process communication RT/Host communication RT/FPGA communication FPGA personalities Interrupts Datalogger (file I/O)
Design flow Simulation Inter-process communication RT/host communication Derived clock domain IP blocks FPGA personality
Get connected Email Web services UDP TCP IP addresses
Site Map
Guides Code examples Procedures Tags LabVIEW block diagram elements Targets Communications All pages
Glossary How to use About
RIO Developer Essentials Guide for Academia
RT procedure

Make your first RT application

Follow along with this step-by-step tutorial to make a "hello, world!"-like application to experience the advantages of multiple linked VIs running simultaneously on the real-time (RT) target and desktop computer: (1) "RT Main" runs as the RT target start-up VI, blinks the onboard LEDs, and reads the onboard button; these onboard devices physically connect to the FPGA I/O pins which are accessed with the Academic RIO Device Toolkit Express VIs and default FPGA personality, and (2) "PC Main" VI runs on the desktop computer as a user-friendly human-machine interface (HMI) for remote command and control of "RT Main" through the network via shared variables hosted on the RT target.

https://youtu.be/I43pZm0SeCQ (24:42)

Code from the video: quickstart_rt.zip


Step 1 of 5: Create a new LabVIEW project

  1. Start LabVIEW
  2. Create a new empty project and save it as “first RT application”
  3. Add the Academic RIO Device

Step 2 of 5: Create and deploy the network-published shared variables (NPSVs)

  1. Create the variable “LEDa” under the Academic RIO Device target
  2. Select “Network-Published” as the variable type
  3. Select “Boolean” as the data type
  4. Repeat for the remaining Boolean variables: LEDb, pause, paused, and stop
  5. Create the variable “loop time” as U32 data type
  6. Save the library as “first RT app”
  7. Register IP address of the Academic RIO Device
  8. Deploy the shared variables to the Academic RIO Device so that they persist across power cycles
  9. Confirm that the variables are visible on the network using the “Distributed System Manager” tool

Step 3 of 5: Create the RT VI to run on the RT target

  1. Create a new VI under the RT target
  2. Save the VI as “RT Main.vi”
  3. Open the block diagram of “RT Main”
  4. Change the icon name to “RT Main”
  5. Insert initialization code for the shared variables “loop time”, “paused”, and “stop”
  6. Insert code for Process Loop #1:
    • Read the onboard push button state and “pause” network-published shared variable (NPSV) as the oscillator enable
    • Write onboard LED0 as the oscillator output
    • Write onboard LED1 as the complement of the oscillator output
    • Write onboard LED2 as the paused state
    • Indicate paused and LED states on the front panel
    • Vary the blink rate with a shared-variable
    • Loop until the “stop” shared variable becomes true
    • Turn off the LEDs when the process stops
  7. Insert code for Process Loop #2:
    • Blink LED3 once per second using a timed loop
    • Turn off the LED when the process stops
  8. Test and debug the code until it works properly

Step 4 of 5: Create the PC human-machine interface (HMI) VI (PC host)

  1. Create a new VI under “My Computer”
  2. Save the VI as “PC Main.vi”
  3. Open the block diagram of “PC Main”
  4. Change the icon name to “PC Main”
  5. Insert code:
    • Place controls and indicators, one for each shared variable
    • Bind the controls and indicators to the shared variables; use the “Shared Variable | Front Panel Binding Mass Configuration” tool to do all at once or select the “Data Binding” property for each control/indicator
    • Idle loop with an event structure that stops when the “Stop Button” is clicked
  6. Run “RT Main”
  7. Run “PC Main” and confirm that “RT Main” can be remotely controlled through the network by the HMI running on the desktop computer
  8. Stop “PC Main”; the “RT Main” VI should still be running
  9. Run “PC Main” again; it should resume contact with “RT Main” and be able to control it remotely

Step 5 of 5: Set “RT Main” as the start-up VI

  1. Create a new build specification for a “Real-Time Application”
  2. Enter the name of the build specification
  3. Select “RT Main” as the start-up VI
  4. Build the application
  5. Select “Run as startup”
  6. Restart the Academic RIO Device and confirm that the VI runs properly (LEDs blink, button works) shortly after the Device finishes booting up
  7. Run “PC Main” and confirm that “RT Main” can be remotely controlled through the network by the HMI running on the desktop computer

For more information

  1. NI myRIO Project Essentials Guide (http://www.ni.com/tutorial/14621/en/)
    Learn how to write RT applications to interface with a wide variety of peripheral devices.