02-02-2009 01:52 PM
Hello, first to apologize for my bad English
I made a program for driving a stepper motor CW and CCW with pulse.
I used USB-6008 for sending pulse to a motor driver..
Now I’m making a program for driving a motor with typed in code:
-------------------------------------------------
F=4 // Forward (CW) 4 steps
B=12 //Backward (CCW) 12 steps
S=2000 //Speed 2000
B=2 // … and so on…
….
Parser splits this code in 2 array’s then determinates a tip of command and then sends them to a block for driving a motor..
PROBLEM: Motor driving block is not responding ()
(In Motor driving block Instead of pulse generator I’ve putted a random number generator. Just to avoid constant connecting a hardware )
Pleas help mi solve this problem. Thanks in advance !
02-02-2009 02:38 PM
You have essentially 2 VI's.
Step Motor Bot.vi which also calls motor VI
Parser.VI which does not call anything.
The step motor bot. vi does not have any while loop around, it just calls motor.vi once.
Is Step Motor Bot.VI your master VI? How are you running it? It only runs once.
I think you have archtitecture problems in terms of what VI is calling what.
02-02-2009 04:22 PM
Step Motor Bot.VI is master VI.. it calls Parser.VI once and Motor VI tvice.
Put them in one folder and start Motor Bot.vi
Set vertical Toggle switch on "Manual". Set "Steps" on vhat ever value you whont and press Run. It generates a randum namber in evri 1000 ms for number of time you setted. then it stops..
If you wont to set this for code parsing: Enter lines of code in text box, switch on "Manual" and press Run. You will see the diference..
It onlly runs once for each setings, thats OK. Problem is: It sets values forom code to numeric control, direction to direction switch, but those are not senth to Motor.vi for generating a randum number (sending puls to motor). Nothing hapends luck on FORW/BACKW. numeric indicator.
02-02-2009 04:48 PM - edited 02-02-2009 04:49 PM
Step Motor bot only runs once.
If you pick Auto and run it, the block gets parsed into two arrays. You pick out the first row of the array and send that to STM. But there is nothing left to loop back and and set the other values in your parser. Turn on Execution Highlighting and run it. I'll think you see what is going on.
I think you still need to rethink your architecture. I think the Action Engine nugget would help you figure out what you want to do.