LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to wait for different source of occurrences in same loop

Thank you for responding.  It would probably have helped us better understand what you wanted to do if you gave a better, more detailed explanation of it.  But now that I know that you are using a fairly recent (i.e. LabVIEW 2016 or later) version of LabVIEW, I think I would suggest a Messenger Asynchronous Channel Wire (or, more simply, a Messenger Channel Wire).

 

The Messenger Channel is a many-to-many asynchronous communication path.  You create a single "Listener" Loop with the Channel Reader, which sits there "listening" for any Message coming in.  It "blocks" if there are no Messages (meaning it just waits), but when a Message is written to any of the Writers connected to it, it will Read the Message and process it as specified.

 

You can learn more about Channel Wires, including the Messenger Wire, by opening LabVIEW, Help, Find Examples, search for "channel".  Start with Channel Basics.

 

Bob Schor

0 Kudos
Message 11 of 14
(580 Views)

@d.ry wrote:

 

The whole thing why i thought I give them ago, I wanted to pass  /notify / send events , signal  to different sub-loops or sub-systems  from a dedicated place where I monitor my buttons.  So say, if I have a global "kill all" switch,  I want all working sub-states to receive it and do what's needed and exit normally.

That's just one example, but a good one for me, there is a couple of such global buttons or switches , yet I don't want to be reading them in every single sub-work or loop  (i.e. also possibly avoid the polling of them in many places).

 


Let me iterate once more that occurrences are not the right tool for this. Once you have multiple different occurrence wires crisscrossing the diagram, it becomes unmaintainable. Better alternatives have been mentioned.

 

You could even have an event structure in every loop, doing the regular stuff in the timeout case and each having another event for the shutdown button (With few exceptions, you can have as many event structures (one per loop max!) as you want listening to the same value change and all will fire (exceptions are discarded filtering events. Once the first event structure discards it, the others will never see it)

 

 

0 Kudos
Message 12 of 14
(564 Views)

Hello Bob_Schor,

 

Thank you for the pointers and suggestions. I have to read up a bit on this, may be, see what is easier myself to get working faster.


I will check out the Messenger Channel, it sounds promising.   (Except that for some cases, I don't want to sleep but rather be interrupted I guess..)

 

I will start with the help you mentioned.

0 Kudos
Message 13 of 14
(546 Views)

Hey altenbach,

 

Thank you.   I'm new to LV, and choice of occurrences was almost like : "Hey, what are these, they look cool and short to setup".

But there are many little blocks  & icons in toolbox here I have to clue yet how to use really 🙂

 

> ... you can have as many event structures (one per loop max!)

 

Ok, i kinda, wanted > 1 event per loop.  (But may be that event structure you mention here doesn't mean one event;  off to read i go).

 

Thanks for advise .

0 Kudos
Message 14 of 14
(544 Views)