Jump to content

Controlling a Stepper motor


Recommended Posts

I am using a NI USB 6008 to control a 2 pole stepper motor. The driver I have is controlled via 4 digital outputs from the DAQ (ie: Step 1 AB, Step 2 BA*, Step 3 A*B*, etc).

What I've done is out all 4 outputs for each step into a its own frame in a Timed loop (So in the 1st frame, aka step 1, 5V on A and B and 0V on A* and B* and so forth for all 4 steps), using the period of the Timed loop I can then control the speed at which the motor will turn & using the iterations, how far it will turn.

My problem comes in that the Timed loop does nothing, when I run the VI nothing happens and when I check the number of iterations the loop has run though, the probe says 'not executed'. My knowledge of Labview comes mostly from my own messing around, so I'm sure its something simple I don't know, but I've looked through the examples in Labview and cant find anything that would change mine.

My VI is attached below

If anyone has any suggestions as to what could be causing this problem or a better way as to control the motor using the 4 digital outputs, just shout (Or if you need for info as to what/why/how I'm doing it).

Thanks

Motor Control.vi

Link to comment

Well, first, I’m assuming this is a learning project, rather than having motor control as the main purpose (if not, say so, because there are much better ways to control a stepper motor).

I can’t run the code because I don’t have the 2011 DAQ stuff installed, but looking at you VI I see that you have cut-and-paste the complete code from a DAQ example several times into the outer timed loop 16 times. Because this example itself has a continuously-running loop in it, and doesn’t stop running until you hit its STOP button , the outer timed loop never finishes its first iteration, because the code inside it never finishes.

You would be better off making a copy of a DAQ example VI and then try to modify it to suit your needs. There is probably an example that controls N lines for N samples at a specified rate; that one might be the best. Avoid loop-inside-loop until you have more experience, and learn to create a subVI as an alternative to multiple cut-and-paste.

Hope this helps,

— James

BTW, these types of questions might be better posted on the NI.com LabVIEW board; many more potential respondents.

Edited by drjdpowell
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.