LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed with Wait on Notification from Multiple not working

Greetings,
 
In the app I'm building, I have an event structure in a while loop monitoring user-interface
interaction.  In parallel with the event structure's while loop are many VI's running in parallel,
waiting for notification to be sent from the event structure.  There are acquisition and output
loops that always run, and others that are triggered by the acquisition loop when it acquires
new data.  Before acquisition starts, all these loops must use the Wait on Notification from Multiple.vi
to see if the start button or the exit button is pressed.  I create notifiers and write them to a
functional global prior to the spawn of the event structure and other loops.  The other loops
read from the functional global and build arrays for the notifiers that they need to monitor.
 
Now to the problem:  Everybody is waiting for the start or exit button to be pressed.  If I
press the exit button, sending a boolean TRUE with the exit notifier, all the loops wake up
and proceed, but read a value of FALSE when they pull that notifier's value out from the array of
notifications.  Thus, they execute code for the case of the start button being pressed
instead of the exit button, and since no DAQmx tasks have been created, the program
terminates.  This is not the graceful termination I had intended for the exit button.
 
I can guess that it's either the use of the functional global of notifiers, or that each loop
builds an array of notifiers from the globals that's causing the problem.  However, I need
the loops to be outside of the event structure so that the acquisition and analog output
can run in parallel and continuously while the front panel is monitored.  I can't do what
I could do in LabWindows which is launch the data acquisition thread when the start
button is pressed.  To do this within the event structure would lock the user interface
since the acq thread requires the user to press the stop button to terminate and the
event structure wouldn't be able to check the UI until the thread terminated.
 
Any suggestions?  I'm relatively new to LabView (we're using v7.1), so every little bit
helps.
 
Thanks,
Kevin
0 Kudos
Message 1 of 5
(2,622 Views)
OK, so I broke it down into a far simpler loop-based task.  The event structure
monitors the user interface for button presses (lights.vi).  When a button is pressed, a
the corresponding notifier is alerted.  Another loop waits for notification from multiple
on a built array of the notifiers, and I would think, would indicate which notifier woke
it up by which value in its notifications output was true (since a true is sent with
the notifier).  It would then decide which front panel indicator to illuminate. 
However, no matter what button is pressed, it is only ever the first element
in the notifications array that carries a true.  Is this how it's supposed to work?
I realize that things involving the user interface should be done in the user interface thread,
but this is a simple way to illustrate my question about notification.
 
Thanks again,
Kevin
 
LV 7.1
0 Kudos
Message 2 of 5
(2,606 Views)
Hi Squidmixer,

What you see is expected behaviour, the help writes it a litte bit cryptic I'll try to better explain it
.
The notifiers out output, contain an array of all notifier that have generated a notification.
The notifications output, is an array matching the notifiers output array with all the notifications.


What you could do is index the 'notifiers out', do a 'get notifier' status, read the notifier name and do the appropriate action.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 5
(2,601 Views)

Hi Ton,

So if I'm understanding correctly, it is correct behavior for the first

element in the notifications array to always be the one that is signalled,

regardless of which notifier tripped it.  It then sorts the notifiers out to

indicate which one was responsible for the notification.  I'll give this a

shot. 

 

Thanks again,

Kevin

0 Kudos
Message 4 of 5
(2,590 Views)

It worked!  Get the zero index notifier out, get its status, wire its name to a case structure,

take appropriate action.  Thanks for the help.

 

Kevin

0 Kudos
Message 5 of 5
(2,582 Views)