Automatic subroutines for monitoring conditions, Example - limit switch – Galil DMC-2X00 User Manual

Page 147

Advertising
background image

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-2x00
program sequences. The DMC-2x00 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

#COMINT (DMC-2000 only) Communication Interrupt Routine

#TCPERR

TCP/IP communication error (2100 and 2200 only)

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-2x00 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

:ED Edit

Mode

000 #LOOP

Dummy Program

001 JP #LOOP;EN

Jump to Loop

002 #LIMSWI

Limit Switch Label

003 MG "LIMIT OCCURRED"

Print Message

004 RE

Return to main program

<control> Q

Quit Edit Mode

:XQ #LOOP

Execute Dummy Program

:JG 5000

Jog

:BGA Begin

Motion

DMC-2X00

Chapter 7 Application Programming

y 137

Advertising