I have recently heard the same request repeatedly: "How do invoke an action in LabVIEW at regular intervals?" (The simple answer by the way: Timeout case of the Event Structure). But this quickly becomes a little more complicated when you want to perform potentially different actions at different intervals from many places, without having to copy/paste similar code over and over.
So here is a very lightweight class to do exactly that. This "TimerNotification" class allows for an unlimited number of these timers, to run independently and concurrently. The object takes a VI Path for the Callback VI to execute when the timer trigger hits.
Initialize.vi: Configure the object with a Callback VI Path, the Frequency of the timer, as well as optional data to pass to the Callback VI.
Start.vi: Starts the timer and waits for the timer trigger.
Stop.vi: Stops the timer from waiting.
Uninitialize.vi: Cleans up the object and releases the Callback VI.
Get Current State.vi: Gets the current state of the object.
Two documented examples
Example which demonstrates using multiple timers objects.
Example which demonstrates passing complex data to the Callback VI, as well as sharing state information between runs.
If VI Package Manager is not already installed, you should be prompted to download and install it.
From with the VI Package Manager application, select the "Install " button.
The Function Palette should get added to LabVIEW's default palette and titled "Timer Notification".
I would be happy to hear comments or feedback if you have any! Add your comments below or send me a private message.
The VIs do not have right-click shortcut palette entries.
Selecting "Show Palette" from VI Package Manager brings up another palette. I assume this is because VI Package Manager searches for the first VI on the palette (which is Initialize.vi) and finds another on disk.