LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble with timeout in event structure

hello - i have an event structure with a lot of events being executed if a button is pressed, inside a while loop that dalso executes code at each loop iteration.
 
with highlight execution turned on.....if i press a button that tells the motor to go continuously forward, the event case is executed to send that command and then the timeout (with 0 as the constant wired in) obviously executes so the while loop can iterate. within the while loop, im acquiring some data using visa write and read. again, with highlight execute on the motor is smooth and the program runs fine. if i turn it off, and it is iterating faster, the motor moves in spurts really fast, and is no longer a smooth turning of the motor.
 
there is nothing in my code that re-sends the turn motor command - or any other code that affects the motor. i noticed that since the timeout event was added, it causes this.  i don't understand at all why it is doing this. please help !!!!!!!!!!!!!
0 Kudos
Message 1 of 2
(2,406 Views)
I am not able to run your VI since you did not include all the subVIs (checksums, temp, etc).

But I would increase the timeout to say 400 or something larger than 0 ms, otherwise you will execute the timeout a very large number of times.

Also, you do not have a Wait ms in the while loop, so the while loop will execute as fast as it can, which is probably another reason that you are having the motor act strange when you do not have highlight execution on.  I would recommend a wait ms with a constant valvue of at least 100 ms added to your while loop to slow things down a little.

If you still ahve problems, please post your results.  Also, your VI is pretty messy, might help for you to clean it up a little, makes it easier for you and for others to troubleshoot it.

Kenny
Kenny

0 Kudos
Message 2 of 2
(2,396 Views)