Yaskawa SMC–4000 User Manual

Page 367

Advertising
background image

357

SMC–4000 User Manual

The following is the special label that is automatically executed when there is a programming error, a
command given where it cannot be used, or a number out of range for a command. The example below
includes a jump to the #LIMSWI label if the _TC code is 22, which is “Begin not valid due to limit
switch.” This is considered a command error, but is easier to treat as a limit switch error. Similar
conditions could be handled by checking other _TC codes and reacting accordingly. If the error is
anything other than 22, motion is aborted without aborting the program (AB1), then a message is
prompted indicating the type of error and the line number on which it occurred. _ED reports the last line
that had an error. The #CMDERR routine can be finished just like the #POSERR special label, but it is
not recommended because usually there is very little reason to continue execution of the program if there
are serious errors in it. This routine is very useful in two ways:

First, during program design when there will be many programming mistakes, it is convenient to have the
program display the error and line number automatically.

Second, it is safer to abort motion if there is a program fault. Without the AB1command, the motors will
continue doing whatever they were doing before the fault. For example, if they were jogging, they will
continue jogging.

Instruction

#CMDERR

JP#LIMSWI,_TC=22

AB1

MG “Error”{N};TCI{N}

MG “on line”,_ED{F3.0}

MG “Program halted!”

AB

EN

Advertising