#M
Begin Main Program
CB1
Clear Output Bit 1 (pick up pen)
VP 1000,1000;LE;BGS
Define vector position; move pen
AMS
Wait for after motion trippoint
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
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-42x0 has a special label for automatic program execution. A program which has been saved into the
controller’s 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.
Automatic Subroutines for Monitoring Conditions
Often it is desirable to monitor certain conditions continuously without tying up the host or DMC-42x0 program
sequences. The controller 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
DESCRIPTION
#LIMSWI
Limit switch on any axis goes low
#ININT
Input specified by II goes low
#POSERR
Position error exceeds limit specified by ER
#MCTIME
Motion Complete timeout occurred. Timeout period set by TW command
#CMDERR
Bad command given
#AUTO
Automatically executes on power up
#AUTOERR
Automatically executes when a checksum is encountered during #AUTO start-
up. Check error condition with _RS.
bit 0 for variable checksum error
bit 1 for parameter checksum error
bit 2 for program checksum error
bit 3 for master reset error (there should be no program )
#AMPERR
Error from internal Galil amplifier
Chapter 7 Application Programming ▫ 113
DMC-42x0 User Manual
Содержание DMC-42 0 Series
Страница 85: ...Chapter 6 Programming Motion 81 DMC 42x0 User Manual Figure 6 14 ECAM cycle with Z axis as master...
Страница 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Страница 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Страница 206: ...Appendices 202 DMC 42x0 User Manual...
Страница 207: ...Appendices 203 DMC 42x0 User Manual...
Страница 208: ...Appendices 204 DMC 42x0 User Manual...
Страница 209: ...Appendices 205 DMC 42x0 User Manual...
Страница 210: ...Appendices 206 DMC 42x0 User Manual...
Страница 211: ...Appendices 207 DMC 42x0 User Manual...
Страница 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...
Страница 215: ...Appendices 211 DMC 42x0 User Manual...