06-20-2012 02:11 PM
I am writing a vi that controls two stepper motors, and am looking to be able rotate one at a constant velocity, and rotate the other's velocity in a sinewave pattern.
2 Stepper Motors (CTP12ELF10MAA00)
MID-7604 Drive Box
PCI-7330 motion controller
The constant rotation seems to be working well, althought sometimes I run into an issue that the actual velocity is less than the velocity i'm inputing to the motor (by around 10 RPM).
Where I'm having an issue is sending data to move it in a sine wave pattern. I've tried a few different ways to send the data, through sine vi, sine express vi,... but the motor doesn't vary in velocity. It seems to just choose some velocity within the sine pattern its given and run at this velocity constantly.
I saw a previous post, back from a few years ago which is similar to my question as well, but it was never answered: http://forums.ni.com/t5/Motion-Control-and-Motor-D
I'm fairly new to labVIEW with just a few basic programs under my belt.
Thank you for any help you can offer,
06-21-2012 01:47 PM
Take a look at the example below and see if it works on your system. I think it is doing exactly what you are looking for.
Sequence of One-Axis Velocity Moves
06-21-2012 06:57 PM - edited 06-21-2012 07:00 PM
Is there a way to integrate this into an event structure? It seems to require the while loop running continuously, or is that just for the 'read current velocity' portion?
For example what if after a certain amount of time you wanted the amplitude of the sine wave to change?
06-22-2012 02:09 PM
The example has an array of values that represents what speed the motor should run at. The inner while loop reads the current velocity and waits 1000ms(which allows the motor to run at that set speed for one second) and then the outer while loop will pull the next velocity value from the array and then call the inner loop and so forth.
There are multiple ways to implement what you are looking for. A quick way using this examples would be edit the inner while loop to have a wait of 5ms and have a button wired up to the “Stop if True”, so that you continue to run at a set velocity until the user presses the button, which will load up the next velocity value from the array. Or instead of a button just write some logic to wait a certain amount of time before loading the next value.
You could write your own logic and event structures if you want. All you need to do is follow this example. So any time you want to change the velocity, you will need to load in your target velocity into the Load Velocity RPM.flx and then call Start Motion.flx.