Special label & fault handling routines, Other considerations – Yaskawa SMC–4000 User Manual

Page 314

Advertising
background image

304

SMC–4000 User Manual

Special Label & Fault Handling Routines

Fault Handling routines are the special labels that automatically execute without being referred to in the
program with a JP or JS. They are the following

The #CMDERR, #POSERR, and #LIMSWI routines are highly recommended for all programs to greatly
increase their robustness. It is very important to integrate Special Label routines with care by thinking
about the program logic required to make the machine run properly. The following are some DO’s and
DON’Ts:

Other considerations

• There is a chance that the special label routines could execute just after power up, but before the

initialization, section has completed. If any of the special routines jump back to the #MAIN loop
after recovery, problems could occur because of items that were “skipped” in the initialization. To
avoid this, use a flag such as the one in the above examples called “InitPass” and check it’s value
when deciding where to resume after a special label event. It is possible that the servo could have
following error when the program starts, and the program will immediately jump to #POSERR. Once
the following error is cleared, the #POSERR must check the initialization flag and jump back to the
top of the program to attempt to initialize again.

• If a Command Error occurred in the #CMDERR special label routine, it will recursively call itself (to

indicate the additional command errors), and eventually cause a stack overflow. This condition may
cause the controller to behave strangely. Be extra cautious when programming the #CMDERR
routine. Minimize the code in the routine to limit the chance of creating a programming error. If you
suspect a #CMDERR in the #CMDERR routine, place an MG command as the first command within
the routine so you can see the message print out at the terminal screen of Yterm each time an error
occurs.

• If a thread other than thread zero causes a command error, this can be determined in code by using the

_ED1 parameters. If another thread had an error, it may be possible to restart the thread although
many errors will eventually require a program fix. Use the HX and XQ commands within the
#CMDERR routine to restart the thread at it’s main label. Usually it is too complex to have a thread
resume after a fault. Remember that all special label routines run as subroutines of thread zero, so in
this case, an RE command will be necessary for thread zero to resume.

Refer to section 10 – “Example Applications” at the back of the manual for a detailed discussion of the
Special Label error routines.

#AUTO

Auto program execute at power up or reset.

#ININT

Input interrupt for any combination of local inputs

#CMDERR

Command error in program handler

#POSERR

Excessive position error

#LIMSWI

Limit switch

#TCPERR

TCP Error

#MCTIME

Motion complete timeout

DO

DON’T

Abort motion for safety if a #CMDERR occurs. Use AB1

Don’t return to the program using RE if a #CMDERR
occurs.

Under #CMDERR, include a method for the error code
(_TC) and line number (_ED) to be identified by someone
who can help debug the program. Store them in a variable
and present them on an operator screen.

Don’t call subroutines from within the #ININT special
routine and forget to do an RI. This would leave the
controller thinking it is handling the interrupt, and
additional interrupts cannot occur. Keep interrupts simple
and short.

Check for software and hardware limits for each axis in
the #LIMSWI routine.

Don’t set the software limits FL and BL to the same value;
the servo will not be able to move once it crosses that
position.
Don’t use the ZS command to correct programming
problems with the JS and JP commands.

Advertising