98
•
Chapter 7 Application Programming
DMC-1000
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
For example, the #POSERR subroutine will automatically be executed when any axis exceeds its
position error limit. The commands in the #POSERR subroutine could decode which axis is in error
and take the appropriate action. In another example, the #ININT label could be used to designate an
input interrupt subroutine. When the specified input occurs, the program will be executed
automatically.
NOTE: An application program must be running for automatic monitoring to function.
Example - Limit Switch
This program prints a message upon the occurrence of a limit switch. Note, for the #LIMSWI routine
to function, the DMC-1000 must be executing an applications program from memory. This can be a
very simple program that does nothing but loop on a statement, such as #LOOP;JP #LOOP;EN.
Motion commands, such as JG 5000 can still be sent from the PC even while the "dummy"
applications program is being executed.
Instruction Interpretation
#LOOP Dummy
Program
JP #LOOP;EN
Jump to Loop
#LIMSWI
Limit Switch Label
MG "LIMIT OCCURRED" Print Message
RE
Return to main program
XQ #LOOP
Execute Dummy Program
JG 5000
Jog X axis at rate of 5000 counts / sec
BGX
Begin motion on X axis
Now, when a forward limit switch occurs on the X axis, the #LIMSWI subroutine will be executed.
Notes regarding the #LIMSWI Routine:
1)
The RE command is used to return from the #LIMSWI subroutine.
2)
The #LIMSWI subroutine will be re-executed if the limit switch remains active.
3)
The #LIMSWI routine is only executed when the motor is being commanded to move.
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com