Go Down

Topic: Stepper Motor L297 Step Program (Read 1 time) previous topic - next topic

ash901226

Dec 09, 2012, 05:13 am Last Edit: Dec 09, 2012, 05:14 am by ash901226 Reason: 1
Hello and hi all,
I made this post due to the fact that i need a program to give the step signal for L297 Ic. I know that most of the step sequence have been done by the L297 Ic but now the problem that i am having is how to  make the step sequence for the L297 is such a way that i could count the number of step that i am giving to the L297 and how to make it non blocking,

I know that using a For loop is consider as blocking and using do while is also consider as blocking. How may i approach this problem and how can i make the program expandable.

Ouh yeah I have also pose an almost similar question On the programming Question department,
http://arduino.cc/forum/index.php/topic,136469.0.html Hope this isnt consider as a cross post

rweber95

I have a stepper  motor application that uses switches that manually command movement of the motor.  The software uses a while loop like this:

while(CWCommand()) rotate(CW);//Single step CW while switch is ON.
while(CCWCommand()) rotate(CCW);//Single step CCW while switch is ON.

The CWCommand() and CCWCommand() functions test the two switches returning true if the either is ON.  The rotate() function looks like this:

void rotate (int whichway){
  if (whichway == CW){
    motor.step(1);//Single step CW and increment position counter
    ++Position;}
  else if (whichway == CCW){
    motor.step(-1);//Single step CCW and increment position counter
    --Position;}}

The motor only does one step each time thru the loop so doesn't block you from doing other stuff inbetween steps.

Bob Weber

ash901226

Thanks this is really help me understand how that step work.

Go Up