Accessing the User LEDs on a cFP or cRIO Controller

Updated Feb 15, 2023

Environment

Hardware

  • CompactRIO Controller
  • CompactRIO Single-Board Controller

Software

  • LabVIEW Real-Time Module
  • LabVIEW

Driver

  • NI CompactRIO

  • I have a cFP/cRIO controller and I want to use the User LEDs to give status information to the user.  For example, I want to indicate that the unit has booted successfully or communication has been established with a host.  How can I do this?
  • How do I programmatically change the status of the User1 LED on my CompactRIO?
  • How do I change the colour of my User1 LED on my CompactRIO/sbRIO?

User LED on cRIO

On a cRIO system, User LEDs are accessed from the LabVIEW Real-Time code.  Some controllers also have an FPGA LED that can be accessed via FPGA code.

Right-click the block diagram and select Real-Time»Real-Time Utilities»RT LEDs VI .  To turn the user LED on or off, wire values to the LED Num and State input terminals of the RT LEDs VI.  You can also read the current state of the User LED by wiring an indicator to the Led State output terminal of the RT LEDs VI.

User LEDs are numbered 0 through 3 in software.  If the real-time controller has a single LED, its number is 0. Wire a numeric constant to the LED Num terminal that corresponds to the User LED you wish to light.  Wire a numeric constant to the State terminal of the RT LEDs VI.  Use 0 to turn the LED off and use 1 to turn the LED on.  The following code works identically for the cRIO and the cFP.  It turns on User LED A. 


The following table gives a summary of the different LED States:
 
LED StateBehavior
0Turns off the LED
1Sets the LED to default color 1
2Sets the LED to default color 2
(Note: Not all cRIO devices support LED state 2. For
more information, please refer this link .)
3Toggles between off and default color 1 


User LED on cFP

If you are targeting the cFP system, you can also use a FieldPoint Write VI to turn the User LEDs on or off. Right-click the block diagram and select Measurement I/O»FieldPoint»FP Write (Polymorphic) VI. Create a constant from the FieldPoint IO Point In terminal of the FP Write VI. Select Browse from the constant's drop-down box. In the Select Device section of the FieldPoint Device Selection window, select the cFP controller @0.


From the Select Item section of the FieldPoint Device Selection window, select the desired LED.


Wire a True or False constant to the Values input terminal of the FieldPoint Write VI if you would like to turn the LED On or Off.  The following code works only on the cFP.  It turns on User LED A.