Jump to content
OMRON Forums

Early exit from callsub


daves

Recommended Posts

How do I implement an early exit from a sub procedure (in a motion program)? I can't get it to work or the script parser can't handle it.

 

I want the following:

 

sub: MoveDOffLimit(ID, PerEU, HomeVel, &Error)
local iLim;
if (AxisSimulate(ID))
	return;
callsub sub.GetDOnLimit(ID, &iLim);
if (iLim)
	// Code removed
return;

 

This gave error "invalid parameter number in equation : R0=ID CALLSUB 10003 iLim=R1"

 

I thought that was a hint to move iLim...

 

sub: MoveDOffLimit(ID, PerEU, HomeVel, &Error)
if (AxisSimulate(ID))
	return;
local iLim;
callsub sub.GetDOnLimit(ID, &iLim);
if (iLim)
	// Code removed
return;

 

but that just gave error "invalid parameter number in equation : R0=ID CALLSUB 10001 L0=R1"

 

so I ended up having to do

 

sub: MoveDOffLimit(ID, PerEU, HomeVel, &Error)
local iLim;
if (AxisSimulate(ID) == 0)
{	
	callsub sub.GetDOnLimit(ID, &iLim);
	if (iLim)
		// Code removed
}
return;

 

but this doesn't seem ideal

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Guest
This topic is now closed to further replies.

×
×
  • Create New...