Example Code

Real-Time Heartbeat for VIs & Executables

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Real-Time Module
  • LabVIEW

Code and Documents

Attachment

Overview

This simple example shows that a basic heartbeat VI can assist greatly in troubleshooting startup executable and headless VIs. 

 

Description

This VI must not be placed as a subVI inside of a loop.  It contains an infinite loop and will therefore never return, blocking higher level loops from running. This VI must be located under a Real-Time target, or the RT Utility VIs will not be found by LabVIEW and the VI will appear broken.One of the most challenging aspects of programming in Real-Time is determining if your program is in fact running on the target.


Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

There are two ways to use this VI:

 

Approach 1 (for VIs or Executables):  The RT Startup Heartbeat.vi can be placed as a subVI on the top level target VI to indicate when that VI is running on the target.  It should not be placed inside of a loop; the VI contains its own infinite loop and will therefore never return.

 

Approach 2 (for Executables Only):  The RT Startup Heartbeat.vi can be selected as a Startup VI in the Build Specifications of a Real-Time Executable.

 

In either setup, this VI will blink the User LED on the Real-Time target and write out CPU usage to the console.

 

Additional Information or References

VI Snippet 

RT Startup Heartbeat.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.** 

Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
davidadamson
Member
Member
on

Tried using the LabVIEW v11.0 file.  But it's looking for "RT Get CPU Loads.vi." Where do I get that VI?

davidadamson
Member
Member
on

Sounds, looks awesome but it doesn't come with the following subVIs:

RT Get CP Loads.vi

RT Debug String.vi