Stack Manipulation; Auto-Start Routine; Dmc-18X2; Automatic Subroutines For Monitoring Conditions - Galil Motion Control DMC-18 2 Series User Manual

Table of Contents

Advertisement

Example:
An example of a subroutine to draw a square 500 counts per side is given below. The square is drawn
at vector position 1000,1000.
#M
CB1
VP 1000,1000;VE;BGS
AMS
SB1
JS #Square;CB1
EN
#Square
V1=500;JS #L
V1=-V1;JS #L
EN
#L;PR V1,V1;BGX
AMX;BGY;AMY
EN

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

The DMC-18x2 has a special label for automatic program execution. A program which has been saved
into the controllers non-volatile memory can be automatically executed upon power up or reset by
beginning the program with the label #AUTO. The program must be saved into non-volatile memory
using the command, BP. If you include the #AUTOERR routine in your program and you have a
checksum error, this program will execute. For more information, read the operand section of the RS
command in your command reference.

Automatic Subroutines for Monitoring Conditions

Often it is desirable to monitor certain conditions continuously without tying up the host or DMC-18x2
program sequences. The DMC-18x2 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:
SUBROUTINE
#LIMSWI
#ININT
124 ● Chapter 7 Application Programming
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Begin Main Program
Clear Output Bit 1 (pick up pen)
Define vector position; move pen
Wait for after motion trippoint
Set Output Bit 1 (put down pen)
Jump to square subroutine
End Main Program
Square subroutine
Define length of side
Switch direction
End subroutine
Define X,Y; Begin X
After motion on X, Begin Y
End subroutine
DESCRIPTION
Limit switch on any axis goes low
Input specified by II goes low

DMC-18x2

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dmc-1812Dmc-1822Dmc-1832Dmc-1842

Table of Contents