Pages: [1]   Go Down
Author Topic: Stepper Motor L297 Step Program  (Read 1084 times)
0 Members and 1 Guest are viewing this topic.
Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: December 08, 2012, 11:14:59 pm by ash901226 » Logged

Tacoma, Washington, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: