Functional Global variable [FGV] is a VI which is used to store values in an uninitialized shift register [USR, No input will be passed in the left side of the loop]. Values will remain in shift register until the main VI is in memory. FGV vi is used to pass data between loops in a single VI or between VIs in a project.

uninitialized shift register

The other names of FGV are LV2 global, action engines, functional Globals.

Structure of FGV will be either of the following:

  • Passing true to conditional terminal of while loop [Mostly used].
  • Passing one to count in for loop.
  • Using single element queue.

This means that VI will be executed only once.

FGV will always be non-reentrant. Once the FGV VI is called, it will be held by the calling VI. It cannot be used by other VIs until the called VI releases. So it is always a better way to use this instead of global variables. Global variables are reentrant.

If multiple data has to be stored, we can build as cluster and use it. Data will be either written/ read. This will be done based on the action variable [which will be mostly a typedef enum for the addition of actions in future or it can be a Boolean or a function call].

Advantage of using FGV over global variable is non – reentrant, multiple copies of data will not happen since same copy is used all the time.

Let us see a basic example.

In this example, FGV.vi is the functional global VI where action will be read/write. Here I am storing timestamp value in USR. Main.vi uses FGV VI for writing and reading timestamp value. “Action” is a typedef enum control which holds the list of actions.

It is made as typedef such that adding actions will not be difficult in future.


FGV read

FGV write

Main vi:

main block diagram



Leave a Reply