03-02-2010 04:12 AM
Hello.
I have a stepper motor drived by NI 9512 and cRIO 9074.
What I want is to perform x moves, when each move is certain number of units.
I made a while loop, and i connected the execute input to done output using shift register. The condition for the loop stop is the number of moves (x).
I also placed time delay of 100*ms to the loop.
The problem is it takes more time to make a single move (the certain number of units i want). So the while loop goes to its next iteration while the prev move is still performing.
Of course, I can increase the time delay, to 1000*ms for example. But it is not good for me.
What i want is to make the loop going for the next iteration only after the whole move is done. How can i do it?
Thanks
03-03-2010 05:12 PM
Tacchi,
Since the function blocks of NI SoftMotion are asynchronous, they will return before the move is complete. Since the move block may be called multiple times without actually invoking a new move, you want to wait until a new move will happen before you increment the array index. Check the following example for referecne:
03-04-2010 04:18 AM
Hello.
I'm not sure you understood correctly what I have meant.
I have only one move block, and i want it to repeat N times.
The problem is that the move last for 1 sec. for example, but the while loop goes to the next iteration straight after the move starts. I want the loop to move for next iteration only after the move complete!
Otherwise, if N=100 for example, the move starts on the first iteration but the i of the loop continue to rise, and instead of N=100 moves i get only 3-4..
I could enter time bugger time delay, but I can't know how much time the move will take...
Thanks
03-04-2010 06:16 AM
03-04-2010 06:46 AM
Hello.
I didn't really understand how to use the wait for move complete function because i don't know what is board ID input, but i solved the problem by putting Read function into internal while function which runs until the velocity is zero, which means the end of move.
The only thing left is to find how i can switch the execute from low to high and back at every iteration so the moves go automatically. Any ideas?
Thanks
03-05-2010 03:24 PM
Tacchi,
Did you open the example that I referenced? This should show how it is detecting when a move has completed, and only then is it incrementing through the array. The while loop will run more than 100 times, if you have 100 moves. In fact, you cannot run 100 moves in this fashion without at least 200 iterations through the loop. This is because the execute line has to go low between each move.
You should not use the .flx functions with this SoftMotion module.
Here is a scenario:
i execute? done? move# 1 T F 1 <- first move started 2 F F 1 <- first move is still not done (this can repeat for a while) 3 F T 1 <- first move complete 4 T F 2 <- start second move 5 F T 2 <- second move done 6 T F 3 <- third move started
Hopefully this helps.
Regards
03-05-2010 05:42 PM
Yes, i opened the example, but i didn't see how it solves my issue.
But your last explanation gave me an idea.
I think, this way it should work well for me.
Thats what you have meant?
Thanks!
03-07-2010 02:11 AM
pflores wrote:
Here is a scenario:
i execute? done? move#1 T F 1 <- first move started2 F F 1 <- first move is still not done (this can repeat for a while)3 F T 1 <- first move complete4 T F 2 <- start second move5 F T 2 <- second move done6 T F 3 <- third move started
In my system, done becomes true straight after the move starts!
03-08-2010
10:21 AM
- last edited on
10-07-2025
04:59 PM
by
Content Cleaner
Tacchi,
The screenshot you posted looks better, but you are obvioursly not cycling through an array of positions. It will read the value of the front panel control and move 5 times. Try adding an array like in the example to pre-define what positions you want to include in the move.
Also, check out the help files (should also be installed on your machine) for the SoftMotion module. In the article titled "Using NI SoftMotion Function Blocks", it states the following two attributes:
- "busy, done, error out, and aborted are mutually exclusive and set at any given time. Only one of these outputs can be TRUE at any time on one function block. If execute is TRUE, one of these outputs must be TRUE."
- "Every function block has a busy output, indicating that the function block operation is not complete. busy is set at the rising edge of execute and reset when either done, aborted, or error out is set."
This sounds to me like the busy output is guaranteed to be true at least once before done is set. When running a test on my end, I never see a move started without done going false at least once. Since this is running quite fast, try wiring i, done, and index (your blue wire wired to the shift register) to auto-indexing tunnels and then to an indicator. This will allow you to review the history of these values as the program executed.