From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

if i have more than 20 events do i need to create seperate loop for each . to work independently

Hi all ,

 

I like to use two independent process works inside event structure . but both have different time  delay.

 

so if my both events in same loops . its waits for the another event to finish.

 

but i need a event that should work independently.

 

 

db.PNG

 

 

SO tired with two seperate loops ,working fine . 

 

db2.PNG

 

 

My question is if i have more than 20 events do i need to create seperate loop for each . to work independently 

0 Kudos
Message 1 of 6
(2,688 Views)

You should use two loops, first one with event structrure. In the events you can send command to the second loop, which process to launch. In second loop you should have separate subVIs (processes) which should be launch, depending on the message from event structure. 

Process should be launched using start Asynchronous Call.

Message 2 of 6
(2,680 Views)

Hi thanks for a response ,

 

if you dont mind ,

 

do you have any example file?

0 Kudos
Message 3 of 6
(2,672 Views)
0 Kudos
Message 4 of 6
(2,645 Views)

Open LabVIEW, go to File, New, From Template, and choose Producer/Consumer (Events).  [Note I might have the name wrong, it might be Consumer/Producer].

 

This is a very common pattern for coordinating parallel loops.  One loop "produces" things to do, in this case, Events that signal "do this task".  The other loop "consumes" the tasks that the first loop creates.  The notion, when using Events, is that the Event loop patiently "waits" for an Event, taking no CPU time, then when an Event occurs, it is handed off to another routine that executes it.  Note that Queues are usually used to convey signals from Producer to Consumer.

 

If you have two (or more) processes that need to "consume" Events in parallel, you have several possible choices.  One is to have multiple Consumers (which sometimes requires multiple Queues, one for each Consumer).  The other is to "spawn" an asynchronous sub-VI to do the work.  I'm not sure where to point for an example, but a look at the examples for Start Asynchronous Call would be a place to start.

 

Bob Schor

0 Kudos
Message 5 of 6
(2,630 Views)

Hi,

 

If you search example finder  with key word "Asynchronous" you will get more information regarding you question.

 

 

Thanks,

Badri

0 Kudos
Message 6 of 6
(2,620 Views)