LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to start/stop 2 parallel while loops

My question might be simple to answer for experts, but as a Labview beginner would be great to receive your help:

 

I hav a VI with two parallel while loops. The first loop runs in a tact of 100 ms to aquire voltage, speed and to output a speed setpoint for a motor in the same tact, read from a table.

 

Finally all values are written to a log-file.

 

The question: As soon as I run my VI, data logging starts too and my motor runs. How can I implement a button to start all loops parallel, and how can they be parallel be stopped too if I want to stop measurement? Tryed to set a local variable for both stop buttons but it didn´t work.

 

Thanx to all, Markus

Download All
0 Kudos
Message 1 of 5
(2,858 Views)

Looks to me like you want two FOR loops due to your table.


GCentral
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 5
(2,837 Views)

There are countless threads regarding this topic with lots of examples posted. You may also want to look at the producer/consumer and state machine examples that ship with LabVIEW. Queues and notifiers are good methods for sending data to parallel tasks.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 5
(2,812 Views)

Starting the two is easy; use the error cluster to enforce dataflow.

 

Stopping them is a little trickier; the code you have now isn't very expandable so I'd recommend finding a different architecture.  A notifier functions like a queue with a size of 1, a queue works well for sending commands/data between loops.

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

@SnowMule wrote:

Starting the two is easy; use the error cluster to enforce dataflow.

 

Stopping them is a little trickier; the code you have now isn't very expandable so I'd recommend finding a different architecture.  A notifier functions like a queue with a size of 1, a queue works well for sending commands/data between loops.


There is one other significant difference between queues and notifiers. A queue can only have one reader. If you have multiple readers of a queue who reads it will be random. A notifier can have multiple listeners. It fact, that is it's purpose.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 5 of 5
(2,799 Views)