LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with a step Motor in different regime types (local variables).

Solved!
Go to solution

The program below is used to control a step motor with NI 9401. However it has been designed to work in two ways, when you push the buttom "adelante" or "atras" it turn into one way or another, but if you push "Start" it begin to move in a particular way (that I have indicated) and if you push again the same buttom ("Start") it have to stop (in that way you can push the buttoms "adelante" or "atras" if you want). The problem that I have is with the "local variables", because when the "Start" buttom is unpushed I have three while-loop and I don´t know how to said it to stop when the "Start" buttom has been pushed and the same when the "Start" buttom is pushed, and i push the "Start" buttom to stop it. I have a mess with the function of local variables.

I know that is a little complicated to understand with word, i have tried to explain the most clearly.  I hope that you can help me.

  

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

Lincoln,

 

i believe youre trying to stop parallel loops and youre having trouble using local variables.  Take a look at this example attached.  I think using a notifier should help you a lot.

 

You can use a second event loop outside of your main loop to control which notifier to send.

 

Stop parallel loops



-Matt
0 Kudos
Message 2 of 4
(2,531 Views)

Why do you need 3 while loops?

 

What do you mean by "unpushed"?  The start button is latch action which means it pops back up automatically once it is read.  I think it would be confusing to users to have the same button do two different actions (start vs. stop) when the button appearance is the same.  Why not use "Switch when released"?

0 Kudos
Message 3 of 4
(2,532 Views)
Solution
Accepted by topic author lincoln1991

Hello matt198717,

 

Yes, I think the problem was trying to used local variables in parallel loops. I use this time property node and it work!.

 

0 Kudos
Message 4 of 4
(2,526 Views)