LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel while loops

Hi everyone! I have a question about passing instructions between parallel while loops:

I basically have a VI which is made up of 2 while loops: inside one of the loops there is a state machine,

in the other one there is a case structure inside a while loop. I would like to set one of the cases in the  latter loops as a start command for the state machine.

How can I do that? I've been reading about queues but I don't understand if they suit my needs....

Either way, can I use the state machine as one of the cases of my case structures (I mean, it would be like a while loop inside another while loop which I don't think

is advisable....)?

Thank you in advance.

 

0 Kudos
Message 1 of 9
(3,801 Views)

This is sort of sounding like the Queued Message Handler (often also called the Queued State Machine).  Queues are perfect for sending messages between loops.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(3,789 Views)

So, I read something about Queued Message Handler but I haven't quite figured it out how to make it work in my case...

here is my problem: the state machine which I already have should not start from the same case each time, I need to decide (with a control on the front panel)

from which case it starts...I mean, I cannot create in the state machine somthing like a "start" case so how do I use the message handler?

Sorry if I'm not being clear or making silly questions, I've just started using LV's state machines and multiple loops...

 

0 Kudos
Message 3 of 9
(3,739 Views)

@Turillo wrote:

So, I read something about Queued Message Handler but I haven't quite figured it out how to make it work in my case...

here is my problem: the state machine which I already have should not start from the same case each time, I need to decide (with a control on the front panel)

from which case it starts...I mean, I cannot create in the state machine somthing like a "start" case so how do I use the message handler?

Sorry if I'm not being clear or making silly questions, I've just started using LV's state machines and multiple loops...

 


Put an event structure in the start case , register for front panel events and according event run the state machine.
Re read again QMH and other design pattern slowly you will be able to handle them.

Asking any type of questions are okay , if you give a try to suggested methods and post them.

Message 4 of 9
(3,732 Views)

Hello Turillo,

 

I made a little example VI, try it.

 

 

Greets, Dave
0 Kudos
Message 5 of 9
(3,726 Views)

I'm sorry, I'm not able to upload the VI, when I attach it, I cannot post the message, I get the error message "The contents of the attachment doesn't match its file type." It even doesn't work with a Zip file.

I'll make pictures...

Greets, Dave
0 Kudos
Message 6 of 9
(3,724 Views)

Ok, here are the pics of the little VI

It is easy to create if you use "Duplicate Case / Event"

 

 

 

Greets, Dave
0 Kudos
Message 7 of 9
(3,719 Views)

Thank you Dave! As soon as you'll post the pictures I'll be more than glad to give a look at them!

Neos, thank you to you too...I'll try your suggestion and I'll let you know if it works!

 

0 Kudos
Message 8 of 9
(3,718 Views)

I finally made it work using the event structure which activated a start case in the state machine....

Thank you again!

0 Kudos
Message 9 of 9
(3,685 Views)