06-06-2012 08:44 AM
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
06-06-2012 09:47 AM
Looks to me like you want two FOR loops due to your table.
06-06-2012 11:14 AM
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.
06-06-2012 12:00 PM
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.
06-06-2012 12:44 PM
@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.