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 ]

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

Table 39 - IEC 61131-3 Second Edition.

Table 47 - IEC 61131-3 Third Edition.

Further Information

Program Units

To learn about other program units.

Variable Declarations

To learn about variable declarations.

ST Statements

To learn about ST Statements.

Glossary

For the meaning of terms used in Fernhill SCADA.