11-28-2011 08:58 PM
I'm controlling a stepper motor with LabVIEW and I would like to advance it from a position of 14 to 0 in increments of 1 then back up to 14 in increments of 1 and stop it there. Any suggestions on how I could set up a loop to do this. The routine will be part of a basic state machine and each time I enter this state I would like to do the increment.
Thank you.
Solved! Go to Solution.
11-28-2011 09:20 PM - edited 11-28-2011 09:20 PM
14 or 10? The subject says 10 but the message says 14,
Just keep track of whether you're counting up or down in a shift register. Put 1 in the shift register if you are to count up, -1 if you are to count down. Just add that value to the count you are storing in another shift register. When you hit one end or the other, take the negative of it and put it back in the shift register.
11-28-2011 09:44 PM
I"m not sure exactly what you mean, but I'll try and figure it out.
Thank you.
11-28-2011 09:53 PM
I just figured out what you meant.
Thank you!
11-28-2011 10:35 PM
Attached is my solution.
11-29-2011 11:05 PM - edited 11-29-2011 11:06 PM
Not exactly what I was thinking, but that works.
Another idea. Search for the Ramp Pattern function. (Actually a polymorphic VI). It lets you create an array that either ramps up or down by whatever increment you want. Two of those back to back (one up, one down) and concatenate the arrays to each other should also get you there.
11-30-2011 08:05 AM
Thank you.