08-27-2011 03:13 PM
Iam using a labview to design a VI to control stepper motor, now the way Iam going with this is that I have CDS photorisistor in a voltage divider.. Now the voltage that is comming out of this divider will determine the exact angle the motor needs to rotate. Attached is the program iam going to use that would determine the steps that the motor needs to move. The question I have is what function I can use-so that voltage comming out my sensor would determine the angle my motor needs to rotate.
08-27-2011 04:14 PM
Please attach the VI you build for us to help you. From the what you explained and your attachment, it looks like you would need to calibrate the step of the motor to the voltage output. Say, the minimum step is 3 degrees and it need 20mV to turn 3 degrees. Then next step is to just write voltage in steps if 20mV using function 'Analog Write' and that will turn your motor accordingly.
Hope it helps!
08-27-2011 04:28 PM
Ok well Iam still in the process of building the VI for stepper control. but just to clarify more....I have a sensor voltage comming through DAQ to my Labview...so the algorithm Iam trying to build is that "as long as that voltage is above a certain threshold then motor should rotate this many steps"......so I need to know should I use CASE structure... or something similar..
08-27-2011 05:05 PM
Little confusing compared to what you said last time. I was assuming that you are using your PCI card to generate voltage that drives the current circuit which in turn drives the motor. Thats why I suggested calibration. I don't know exactly how you are controlling the motor.?
08-29-2011 07:17 PM
It sounds like you need a state machine. There are examples of this in the labview help that I higthly recommend looking at.
Your stepper motor requires a sequence of writes to move. This could be acomplished with on-demand writing in a state machine or with an array. Then you can read voltage from your daq card to determine whether to to move again or wait.
There are many ways you could make the system through. If you run into problems why don't you post pictures of what you have/are trying to do so we can help you with more specific questions.
08-29-2011 07:58 PM
After reading your other questions I think I can help you out more. The code you have been looking at is a state machine. In this case "Position" is using a shift register and so is detecting changes from loop to loop, let me know if you don't get how this works.
Know we know that "1" corresponds to "true" usually. So the original example is really just writing:
to move the stepper motor, using digital lines instead of analog lines. Your profs decided to make it hard on you, so you are using analog lines. You will need to figure out the actual voltage required to set your voltage to true. Typically 0V corresponds to "0" or "false" and 5V corresponds to "1" or "true." So first you need to change the system to look something like:
But now we need to write to multiple lines, because we have four different wires to control. You need to figure out which wires to physically wire into your board and what lines correspond to what lines correspond to what on your actual motor. However,writing to multiple lines at the same time is easy, as shown below:
In this example I have written:
This should be enough to get you going, make sure to let us know how it turns out.