Routines
Routines offer the executable code for the project in a controller. A routine is similar to
a program file or subroutine in a controller.
Each program has a main routine by default. This is the first routine to execute when the
controller triggers the associated task and calls the associated program. Use a ladder diagram
instruction or structured text, such as JSR, to call other routines. You can create more
subroutines. The number of routines per program is dependent on the controller memory.
IMPORTANT:
When creating a main routine, it must use the Name
main
. Changing the name of a main routine after creation, removes its designation as
a main routine.
TIP:
The main routine, current routine, and phase state
routine are not valid targets as arguments for a JSR instruction, and do not appear in the
list of ladder diagram and structured text routines.
Specify an optional fault routine for each program in each task. The controller executes the optional fault routine if it encounters an instruction-execution fault in any of the routines in the program.
Provide Feedback