TW 1000

Set the time out to 1000 ms

PA 10000

Position Absolute command

BGA

Begin motion

MCA

Motion Complete trip point

EN

End main program

#MCTIME

Motion Complete Subroutine

MG “A fell short”

Send out a message

EN

End subroutine

This simple program will issue the message “A fell short” if the A axis does not reach the commanded position within 1 second of the end of the profiled move.

Example - Command Error

Instruction

Interpretation

#BEGIN

Begin main program

IN "ENTER SPEED", speed

Prompt for speed

JG speed;BGA

Begin motion

JP #BEGIN

Repeat

EN

End main program

#CMDERR

Command error utility

JP#DONE,_ED<>2

Check if error on line 2

JP#DONE,_TC<>6

Check if out of range

MG "SPEED TOO HIGH"

Send message

MG "TRY AGAIN"

Send message

ZS1

Adjust stack

JP #BEGIN

Return to main program

#DONE

End program if other error

ZS0

Zero stack

EN

End program

The above program prompts the operator to enter a jog speed. If the operator enters a number out of range (greater than 8 million), the #CMDERR routine will be executed prompting the operator to enter a new number.

In multitasking applications, there is an alternate method for handling command errors from different threads. Using the XQ command along with the special operands described below allows the controller to either skip or retry invalid commands.

OPERAND

_ED1

_ED2

_ED3

FUNCTION

Returns the number of the thread that generated an error

Retry failed command (operand contains the location of the failed command)

Skip failed command (operand contains the location of the command after the failed command)

The operands are used with the XQ command in the following format: XQ _ED2 (or _ED3),_ED1,1

94 Chapter 7 Application Programming

DMC-2X00

Page 149
Image 149
Galil DMC-2X00 user manual Example Command Error