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
RIO guide

Software architecture for RIO embedded control and monitoring applications

A standard software architecture that lends itself to a wide variety of system controller designs that require a PC-based user interface.

Diagram of standard software architecture for embedded control and monitoring applications


Many NI Academic RIO Device embedded control and monitoring applications benefit from the standard software architecture pictured above. The Academic RIO Device connects to the physical system by way of sensors, actuators, indicators, and user interface devices. All communication with other devices, including the LabVIEW development computer, is through the network, even when the Device connects to the PC by USB cable (the USBLANUSB-based local area network (LAN) established between the Academic RIO and the PC host computer. is established by the USB cable). The PC host provides a user interface (UI), also known as human-machine interface (HMI), by which the user can connect to the Device, observe the status of the running application and control its behavior, and download datalog files.

The Home Security System application applies the standard software architecture to a practical example modeled on a real product.

This guide will briefly outline the role of each of the VI components of the software architecture and describe common communication mechanisms between the VIs.

PC Host

The User Interface VI (UI) provides a window into the operation of the RT VI as well as a means to control the application. The UI provides a user-friendly experience, its front-panel is carefully laid out, and is responsive to user inputs such as button clicks and mouse movements. The UI often includes the ability to connect to and disconnect from the RT VI without disturbing the RT application itself. The UI contains three distinct processes:

  1. UI Update – Retrieves the status of the RT VI using network-published shared variables (NPSVs) hosted on the RT target. The RT VI writes the NPSV just like a global variable, and the UI VI reads the NPSV in a similar fashion, therefore the NPSV is a type of tagTransfer only the current (most recent) data value between two process loops or between two targets / latest valueTransfer only the current (most recent) data value between two process loops or between two targets communication. Bind a UI VI front-panel indicator directly to the RT-hosted NPSV to eliminate any block diagram coding.
  2. UI Event Handler – Handles user events such as keyclicks and mouse movements with a LabVIEW “Event Structure.” The Event-Driven Producer/Consumer State Machine design pattern works particularly well here; see the textbook by Bress referenced below for more details.
  3. Command Sender – Typically incorporated into the UI Event Handler, the Command Sender issues command messages to the RT application using a network stream channel with the “zero timeout” option to minimize delay (latency) through the network; with this option the network stream is a type of messageTransfer every value of intermittent data with low latency. communication. For example, the UI front panel button “reset” could trigger a similarly-named string to be inserted into the network stream channel that will eventually be interpreted by the RT VI to restart itself.

Academic RIO Device


The RT VI embodies the system controller. The implementation details vary widely depending on the needs of the particular application and the relative level of necessary complexity. The RT VI contains three processes:

  1. Command Parser – Receives messages sent by the Command Sender through the network stream channel. Commands are parsed and sent through queues (a queueA memory construct that stores a sequence of messages or data elements, similar to people waiting in line; also known as a FIFO (first-in, first-out) buffer is a type of messageTransfer every value of intermittent data with low latency. communication) to the message handler which performs the tasks of the particular application. The command parser is commonly implemented as a Queued State Machine.
  2. Message Handler – The message handler contains one or more parallel process loops (“while-loop” structures) that implement the functionality of the particular application. The process loops pass messages to each other through queues and are implemented as Queued State Machines, as well. For example, the Home Security System contains a system manager, error handler, timer, and other process loops related to the user interface, and is an example of the general-purpose Queued Message Handler with Multiple Process Loops design pattern.
  3. Tag Communication – Any status information of interest to the PC Host is connected to network-published shared variables (NPSVs) hosted on the RT target. The RT VI writes the NPSV just like a global variable.


High-performance data acquisition or hardware I/O functionality not available on the default Academic RIO Device FPGA personality would necessitate the development of an FPGA VI, too. The RT VI Message Handler controls the FPGA VI by manipulating the front-panel controls of the FPGA VI with programmatic front-panel communication (RT), a type of messageTransfer every value of intermittent data with low latency. communication, and retrieves the state of the FPGA VI indicators using the same technique.

For more information

  1. NI LabVIEW for CompactRIO Developer's Guide (http://www.ni.com/compactriodevguide/)
    From the webpage: 'The National Instruments CompactRIO Developers Guide provides an overview of recommended architectures and development practices when programming NI CompactRIO controllers. Intended as complementary material to standard LabVIEW Real-Time Module and LabVIEW FPGA Module training, this guide features documentation and examples as a framework for designing industrial control and monitoring applications.'
  2. Effective LabVIEW Programming (http://www.ntspress.com/publications/effective-labview-programming/)
    An excellent textbook by Dr. Thomas J. Bress covering all aspects of system design; Chapter 27 describes the "Producer-Consumer State Machine" in detail. Download all of the code examples from this textbook: follow the link above, select "User Resources", and then "All VIs".