NI Labs Toolkits

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Timed Callback Handler

LabVIEW Timed Callback Handler

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.

Includes

  • Timer Notification.lvclass
    • 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.
  • All public API VIs have context help and icons.

Software Required

Installation Instructions

  1. Download the attached .vip file.
  2. Double-click the .vip file.
    • If VI Package Manager is not already installed, you should be prompted to download and install it.
  3. From with the VI Package Manager application, select the "Install " button.

Notes

  • 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.

Known Issues

  • 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.
Comments
Eric_BOB
Member
Member
on

Sorry but when i open it , there is few forget  or unvalid deftype in your package (current_state,TimerNotification,ErrorType,Timer_Factor_Value,_callbackData,).

I have LV2011 French edition.

Where have you put exemples?

Regards

Eric Bobillier

Phil_J1
Member
Member
on

Hello Eric, I'll try this on a French LV2011 and try to replicate your finding; sorry for the issue. The example should get installed to a "<labview>\examples\Timer Notification" folder. There should be a project there with 2 subfolders. Please open the project. I'll let you know what I find/fix as soon as possible.

Phil_J1
Member
Member
on

Hello Eric, please try timer_notification_class-1.0.0.13 attached above. I was able to reproduce your issue on a French LV 2011 and addressed it. The problem may be related to me using VI Package Manager, so if problems continue, I will simply post the .llb and the examples directly on this page instead.

Patur
Member
Member
on

Hi Phil

Thanks for posting this class.

When trying to install the .vip file, I get the following error message in VIPM:

This package is not compatible with your operating system or any LabVIEW version installed on your computer.

I have LabVIEW 2011 and 2012 (both 32-bit) installed on a Windows 7 pc.

Are there any additional system requirements not listed?

Regards,

Patur Vase

www.hfjensen.dk

--
Patur Sivertsen Vase
www.hfjensen.dk
Eric_BOB
Member
Member
on

Hi Phil

All is ok now. Thanks

Eric

Patur
Member
Member
on

Hi Phil

The error was on my side. When trying to install the .vip from a shared network drive, I get the error message:

This package is not compatible with your operating system or any LabVIEW version installed on your computer.

But when I try to install the .vip file from a local drive, there's no problem.

Again, thanks for posting the class

Regards,

Patur

--
Patur Sivertsen Vase
www.hfjensen.dk
Phil_J1
Member
Member
on

Thank you both for trying this out!!

Contributors