LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop iteration frequency for controlling a stepper motor

Hello,

I need to control a stepper motor using LabVIEW. So I found a VI from my lab which makes the motor go one step and put it into a For Loop. I also need the DAQ to work in real-time,so I didn't put the For Loop inside the VI. That's the base of the program, and there are a few other adjustments (like having a base position) but they are not important. My problem is that I'm not able to adjust the frequency of the steps (I mean,not exactly the frequency but the unit time,like 2 ms between per step) while it's in the For Loop. I'm able to adjust it when the For Loop is inside the one-step VI but then I'm not able to acquire a real-time graph.Is there a way that I can have both of these at the same time?

Forgive me if the problem is too easy to solve,I'm using LabView for only about a week.I've also searched about this in the internet,and in Labview help,but I couldn't find anything except the delay between two iterations,which won't do any help to me (because I want to increase the frequency) I've also tried to turn off DAQ to see if the problem is with the computer,but it didn't also help.

Thank you all in advance for your help.

0 Kudos
Message 1 of 3
(2,793 Views)
Hello,it's me again..
I thought maybe adding the program here would be better.
So,here it is.

The aim of the program is to turn the motor and acquire data while having a base point to go back.

I would be grateful if anybody could help me.
0 Kudos
Message 2 of 3
(2,766 Views)
 

I would keep the for loop inside the sub VI (I assume you are talking about the StepandCount_func_noloop.vi).  Create a waveform graph indicator inside the subVI, then create a Shared Variable and place it in your main VI.  Shared variables are great for sharing information between sub VIs.  That being said, I have a few comments about your post, and your code.

-  The VI uses local variables extensively.  Local variables are good for sharing data between parallel loops (mainly sharinig a stop button).  However, in your case you may run into problems using local variables this way.  Mainly because you can’t be sure what values the local variables are holding at a certain instant in time.  I would recommend taking a look at the following articles for more information.


Avoiding Race Conditions 
Are LabVIEW global variables good or bad, and when is it OK to use them? 

-  In your previous post, you had mentioned wanting your program and DAQ to run in real-time.  Please understand that whenever using Windows you will have inherent latencies.  I cannot say for sure how deterministic you system is because there are too many variables (such as system specifications, installed software, maintenance frequency, environment, etc.) that will affect the performance.  If you don’t mind latencies of about 100-200 ms, then you are fine.

Let me know if anything I mentioned is unclear.

 

Rod T.
0 Kudos
Message 3 of 3
(2,725 Views)