Stack manipulation, Auto start routine, Automatic subroutines for monitoring conditions – Yaskawa LEGEND-MC User Manual

Page 306

Advertising
background image

296

LEGEND-MC User’s Manual

Stack Manipulation

It is possible to manipulate the subroutine stack by using the ZS command. Every time a JS instruction,
interrupt or automatic routine (such as #POSERR or #LIMSWI) is executed, the subroutine stack is
incremented by 1. Normally the stack is restored with an EN instruction. Occasionally it is desirable not to
return back to the program line where the subroutine or interrupt was called. The ZS1 command clears 1
level of the stack. This allows the program sequencer to continue to the next line. The ZS0 command
resets the stack to its initial value. For example, if a limit occurs and the #LIMSWI routine is executed, it
is often desirable to restart the program sequence instead of returning to the location where the limit
occurred. To do this, give a ZS command at the end of the #LIMSWI routine.

Auto Start Routine

If the #AUTO label is included in a Burned Program (BP command), the controller will start executing the
program starting at the location of the #AUTO label when power is applied.

Automatic Subroutines for Monitoring Conditions

Often it is desirable to monitor certain conditions continuously without tying up the host or LEGEND-MC
program sequences. The LEGEND-MC can monitor several important conditions in the background.
These conditions include checking for the occurrence of a limit switch, a defined input, position error, or a
command error. Automatic monitoring is enabled by inserting a special, predefined label in the
applications program. The pre-defined labels are:

CB1

Clear Output Bit 1 (pick up pen)

VP 1000,1000;LE;BGS;AMS

Define vector position; move pen

SB1

Set Output Bit 1 (put down pen)

JS #SQUARE;CB1

Jump to square subroutine

EN

End Main Program

#SQUARE

Square subroutine

V1=500;JS #L

Define length of side

V1=-V1;JS #L

Switch direction

EN

End subroutine

#L;PR V1,V1;BGX

Define X,Y; Begin X

AMX;BGY;AMY

After motion on X, Begin Y

EN

End subroutine

#AUTO

Auto start program on power-up

#CMDERR

Bad command given

#COMINT

Communication interrupt occurred

#ININT

Input specified by II goes low

#LIMSWI

Limit switch on any axis goes low

Advertising