LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping and starting task in while loop

Solved!
Go to solution

I am attempting to start and stop a counter output (creates pulsed output) in a while loop and I am not sure how this can be accomplished. I have a while loop running that is taking measurements from a digital compass. If my heading is within an acceptable range, the counter outputs (2 of them for turning left and right) should be turned off. If the heading is outside the acceptable range, lets say too far to the right, I want to start one of my counter outputs to turn the object to the left. The issue I am having is that if I put the "Start Task" block in the while loop the system will try to start each iteration of the loop, even if it is already on. I don't know if this is a problem, but it doesn't seem efficient from a programming standpoint. I remember reading somewhere that stopping and starting tasks can really slow down a loop. Any suggestions?

0 Kudos
Message 1 of 4
(2,824 Views)

Can you post some code to look at?

Tim
GHSP
0 Kudos
Message 2 of 4
(2,807 Views)
Solution
Accepted by topic author mechEmike

I actually just figure it out. If you use some if statements and the "Is Task Done" block, you can get it to work. 

0 Kudos
Message 3 of 4
(2,802 Views)

Always nice when someone takes the time to figure it out on their own. I usually find then when I ask for help I usually figure it out before I get a responce. Nice to know these guys are here to help if you can not figure it out.

Tim
GHSP
0 Kudos
Message 4 of 4
(2,799 Views)