LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use notifiers?

Can anybody show me a sample of how to use notifier/occurence to get a front panel button result? right now my program uses a infinite loop to poll for an exit front panel button so that when it is depressed the program will be exit. However this seems to be very inefficient and with such concurrent loop running with my main prog, i cant seem to retrieve my data (time critical). i read that notifiers can do the job but dont know how to use it.
0 Kudos
Message 1 of 9
(3,424 Views)
I would suggest using a WAIT function for 100 mSec or so in the main loop. If you don't have that, the main loop will poll your button at a million times per second or more. There's no need to poll the thing that fast - it will starve any other loops.

It means that you will respond to the QUIT button at most 100 mSec later - not a big deal, usually.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 9
(3,424 Views)
Here's an efficient and easy method to do this.

After the first iteration, the loop will wait endlessly with no CPU usage. It will be waken up by any front panel activity and will exit if the button was pressed.

Set the "timeout ms" entry if you want to avoid the endless wait.

Don't hesitate to write a comment if you need further assistance.
0 Kudos
Message 3 of 9
(3,424 Views)
From one of your other postings, I see that you're using LV 7. I would rceomend using the event structure. There's a couple of shipping examples that you cna look at.
0 Kudos
Message 4 of 9
(3,424 Views)
Thanks for the answer. But can you show me also a sample on notifier and occurrence, i want to learn how to use them.
0 Kudos
Message 5 of 9
(3,424 Views)
I only got the standard edition. My program requires the execution of many loops concurrently and when i placed more than 3 loops, my data(from GPIB) cannot be received by LabVIEW. Thus i need to improve on the effieciency of my current program.
0 Kudos
Message 6 of 9
(3,424 Views)
So what happens when you put WAIT functions in the loops?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 9
(3,424 Views)
Here's an example with an occurence. The use of notifiers is similar.

Notifiers offer more functionnality (eg the possibility to pass data) but this is not significant for your application.
0 Kudos
Message 8 of 9
(3,424 Views)
If i put wait functions in the loop i manage to receive more queries but not all of them.
eg. i got queries and commands like "id?", "trm?", "sqb?", etc. so with more loops i cannot read the "id?" (first one) i tried many ways to increase the effieciency of the loops and i manage to receive some (eg. up to "trm?"). but still cannot receive "sqb?". same for wait functions. only when i remove one loop that i manage to get all queries.
0 Kudos
Message 9 of 9
(3,424 Views)