LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with my automated motion (stepper motor)

I'm new to Labview, hoped I could get some help, I have only had experience with VB prior. Let me explain what I'm trying to do.

So far I've tried to create (im sure it is wrong, I haven't tested it yet) a motor control button interface, whereby I can move the position of the motor. The motor will be connected to a threaded rod, so the distance along the rod is what i mean by position. I've made a forward button and backwards button to control this motion. So the motor moves when the button is held down. I also what the position to be shown in the numeric indicator. I've done this by incrementing +1 for every pulse send to the motor in the forward loop and -1 in the backward loop.

 

For instance, I hold forward button, +1+1+1  =3  then hold back button -1 -1 = -2   so I end up with  =1 in the numeric indicator.  Will the numeric indicator go into negative numbers? I want it to be able to.

 

So thats what ive tried to do, I also just shoved the direction pulse output into one of the loops so that it moves the motor the opposite way, is that right?

 

Ok heres what I want to do, your suggestions would be most appriciated.

I want to use a button to set the position from whatever it shows, to zero. Like a reset button.

I want to be able to record the position at any moment, so that i can later make the motor move back to that exact position. 

eg  press a button that makes the motor move back to 0 and a button which then moves the motor the the position that was recorded.

 

Thanks. 

 

 

0 Kudos
Message 1 of 2
(1,918 Views)

Numeric indicators are just that, indicators.  they don't have restrictions on positive, negative, etc.  If you mean a numeric control, right-click and go to properties.  you can set the max/min values and what action to take of the value goes outside those limits.

 

In terms of your button options, this is very easy.  Use a Case structure (controlled by the button).  Inside the true case, wire the value you want to a numeric indicator (or the property node of a numeric control).  You can think of this is as an IF statement that copies the value from one control to another.

 

Since you normally move by holding the button, you will need to place this code in a For loop for the automated move to 0 or move to X processes.  Take the current value and subtract the destination value, this will tell you how many pulses you need (wire absolute value to the N of the for loop) and the sign will tell you the direction.  This for loop will be inside another case structure controlled by the appropriate button.

0 Kudos
Message 2 of 2
(1,900 Views)