Application specific routines – Yaskawa SMC–4000 User Manual
Page 312
![background image](https://www.manualsdir.com/files/819559/content/doc312.png)
302
SMC–4000 User Manual
Application Specific Routines
Application specific routines contain the core logic of the
machine’s modes of operation. The routine only runs
once the logic in the main loop has determined that all
conditions have been met.
The following is an example of an application specific
routine that indexes the servo.
Note: "Automatic Index Subroutine"
#AUTOCYC
Status=sAuto
IF (_MOX=1); SHX; WT 1000; ENDIF
#INDEX
JP #INDEX, ((MODE & IndexGo)=0) & ((MODE &
AutoMode)=AutoMode)
JP #AUTOERR,_RPX<>XHOME
ACX=IdxDist/2/(IdxTime/3)/(IdxTime/3)+3300; DCX=_ACX
SPX=IdxDist/2/(IdxTime/3)
PRX=IdxDist; BGX; Parts=Parts+1; AMX
SB INDEX1; WT Dwell; CB INDEX1
#AUTO_DN
EN
#AUTOERR
Status=sNotHome
ATHOME=FALSE
JP #AUTO_DN
EN
As shown above, supporting routines or functions of an application specific routine can be included below
the routine itself, such as #AUTOERR.
Notice an important point in the #AUTOCYC routine. It is called from the #MAIN loop with a JS (Jump
to Subroutine) command. If there was a jump to the #AUTOERR routine, program flow cannot simply
return to the #MAIN loop with a JP #MAIN. If this were to happen, the subroutine stack would eventually
overflow if this scenario were to happen 16 times. A dummy label #AUTO_DN at the end of the
application specific routine allows for a safe return location, so the main routine can end normally and
automatically return to the #MAIN loop.
Initialization
Main Loop
Application Specific
Routine 1 of…
Fault Handling
Application Specific
Routine 2 of …
Supporting
Routine