IEC 61131-3 Program

Help Contents

Introduction

A Program is a sequence of statements executed in order. You can execute a Program in one of two ways:

Syntax

A Program uses this syntax:

program ::=
  PROGRAM program-name
    { variable-declaration }
    [ program-code ]
  END_PROGRAM

program-code ::= [ structured-text | sequential-function-chart | instruction-list ]

Where:

Remarks

Use any of the following for the program-code:

A Program can reference other Functions and Function_Blocks.

Examples

  1. Use Structured Text to add together tree three tag values and places the result in a global variable:
    Var_Global
        (* Global variable storing total current *)
        PumpStationCurrent : LREAL;
    End_Var
    
    Program CalcTotalCurrent
        (* Calculate total current and store in a global variable *)
        PumpStationCurrent := %"PumpStation.Motor1Current" +
            %"PumpStation.Motor2Current" +
            %"PumpStation.Motor3Current";	
    End_Program

Standards Compliance

IEC 61131-3 Second Edition: Table 39.

IEC 61131-3 Third Edition: Table 47.

Further Information

Program Units

To learn about other program units.

Variable Declarations

To learn about variable declarations.

Structured Text

To learn about Structured Text.

Sequential Function Chart

To learn about Sequential Function Charts.

Instruction List

To learn about Instruction List.

Glossary

For the meaning of terms used in Fernhill SCADA.