Jump to content
OMRON Forums

Motion program stops when nested while loops used


andyf
 Share

Recommended Posts

I have a program with a while loop nested inside another while loop. When I run it, the program stops after one iteration of the outer while loop, and exits. When I run "list apc, 1" it reports that the program stopped at the outer while loop conditional statement. Please advise:

 

open prog 1

 

local Lvar0=0;

local Lvar1=0;

local Lvar2=0;

local Lvar3;

L3=ldata.coord

 

abs

linear

 

// Enable external time base use

Coord[L3].pDesTimeBase=EncTable[8].DeltaPos.a

Coord[L3].TimeBaseSlew=1

 

while( L1 < 5 ) {

while ( L2 < 2 ) {

x10000 tm500

delay 2000

 

x30000 tm500

delay 2000

 

L2++

}

 

L1++

}

 

send 0 "done"

sendall

 

close

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Try increasing the value of Coord[x].GoBack. This parameter is designed to prevent indefinite loops in the program from causing a situation where the next move can't be computed before it is needed to blend from the current move. But you want to be able to jump back in the program twice as you exit the inner loop.
Link to comment
Share on other sites

  • 3 weeks later...

Thanks Curt, that did the trick. I set Coord[x].GoBack=1, and now I can iterate the outer and inner loops any number of times.

 

Try increasing the value of Coord[x].GoBack. This parameter is designed to prevent indefinite loops in the program from causing a situation where the next move can't be computed before it is needed to blend from the current move. But you want to be able to jump back in the program twice as you exit the inner loop.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...