FIRST Robotics Competition Blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Functional Global Variable Snippet

Whit-E_Wall-E
NI Employee (retired)

Functional Global Variables (FGV) are a great method of storing information. Because a true constant is wired to the stop condition of the while loop, values are saved in the shift registers of the while loop and are preserved when the VI is called again.

This FGV saves the system time in a shift register at the start of the timer. When reading the time, the current system time is compared to the system time at start. This particular FGV Timer allows for Start/Reset, Read, Pause, and Resume. It is important to note that FGVs must be called from a calling VI.

This FGV timer and FGVs in general can be applicable to much in FIRST Robotics. Any time you want to perform a certain function for a specified amount of time this will be useful.

National Instruments has a very active community outside of ni.com/frc that are always posting neat applications or example code they have developed to share with other LabVIEW users.  Here is a community example where you can automatically create FGVs through a quick drop keyboard shortcut.

FGVTimer.png

Here is a white paper on how to use a snippet in your program.

Regards,

M. Whitaker
ni.com/support