Routines
Routines provide 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 function block, such as JSR, to call other routines. You can create additional 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 it has been created 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 function block 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