Jump to content
OMRON Forums

Program aborts in while loop


maxvoxel8

Recommended Posts

We defined a g-code which sets some variables and then fsaves. We are using the recommended code for sending a command:

 

Ldata.CmdStatus = 1

cmd"fsave"

sendallcmds

do dwell 0

while( Ldata.CmdStatus == 1)

 

We have found that sometimes (maybe one in 20 program executions) the program aborts while inside the while loop. I figured this out by setting a variable in the while loop and clearing it after. I found that the variable is set when the program aborts. It doesn't set any error flags that I've found when this happens.

 

I found this previous thread which recommends setting Coord[x].GoBack to deal with a similar-sounding situation:

 

http://forums.deltatau.com/showthread.php?tid=1041&highlight=sendall

 

I set GoBack to 1 and we will see if that helps us. However I am confused about how Coord[x].GoBack behaves. According to the manual:

 

"When this function detects (GoBack + 2) jumps back in the program while looking for the next command that creates equations of motion of sufficient time, it automatically recalculates the end of the most recently calculated move to bring it to a stop at its programmed endpoint, just as if there were a dwell command after the move."

 

So it sounds as if a lower value of GoBack should simply result in the equivalent of a dwell 0 being inserted into the program. But I already have a dwell 0 in each loop. So does GoBack behave differently from the manual? Or is something else going on?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Update: The error occurred with Coord[x].GoBack set to 1. I tried setting it to 255, and it caused the PMAC to become unresponsive to the NC UI, which I also don't understand. Now testing with the value set back to 3.

 

Update 2: The error still occurs with Coord[x].GoBack set to 3. So it seems that Coord[x].GoBack is not helping.

Link to comment
Share on other sites

  • 2 weeks later...
I'm not sure the go-back idea is relevant, there's a good chance that was about exiting multiple while loops and they wanted blending to work properly. Commands like save and fsave can take some time. Waiting for Ldata.CmdStatus only really makes sure the fsave started, you may need an additional timer to be sure it is finished before sending additional commands.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...