Overview of Subroutines

Subroutines are programmed as separate entities, either in:

  • Ladder language (LD),

  • Functional block language (FBD),

  • Instruction List (IL),

  • Structured Text (ST).

The calls to subroutines are carried out in the sections or from another subroutine.

A subroutine cannot call itself (non-recursive).

Subroutines are also linked to a task. The same subroutine cannot be called from several different tasks.

Example

The following diagram shows a task structured into sections and subroutines.

Characteristics of a Subroutine

The following table describes the characteristics of a subroutine.

Characteristic

Description

Name

32 characters maximum (accents are possible, but spaces are not allowed).

Language

LD, FBD, IL, or ST.

Task

MAST, FAST or Auxiliary

Comment

1024 characters maximum