0% found this document useful (0 votes)
18 views1 page

Structure Text Programming - Codesys 1

The document provides an overview of Structured Text (ST) programming, including its basic structure, syntax, and key components such as variables and functions. It highlights the objectives of learning ST, which include writing functions and understanding its parallels and differences with Ladder Logic and Allen Bradley standards. An example program demonstrates the use of loops and variable declarations in ST programming.

Uploaded by

edlistianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Structure Text Programming - Codesys 1

The document provides an overview of Structured Text (ST) programming, including its basic structure, syntax, and key components such as variables and functions. It highlights the objectives of learning ST, which include writing functions and understanding its parallels and differences with Ladder Logic and Allen Bradley standards. An example program demonstrates the use of loops and variable declarations in ST programming.

Uploaded by

edlistianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

329

19. STRUCTURED TEXT PROGRAMMING

Topics:
• Basic language structure and syntax
• Variables, functions, values
• Program flow commands and structures
• Function names
• Program Example

Objectives:
• To be able to write functions in Structured Text programs
• To understand the parallels between Ladder Logic and Structured Text
• To understand differences between Allen Bradley and the standard

19.1 INTRODUCTION

If you know how to program in any high level language, such as Basic or C, you will be com-
fortable with Structured Text (ST) programming. ST programming is part of the IEC 61131 standard.
An example program is shown in Figure 261. The program is called main and is defined between the
statements PROGRAM and END_PROGRAM. Every program begins with statements the define the
variables. In this case the variable i is defined to be an integer. The program follows the variable decla-
rations. This program counts from 0 to 10 with a loop. When the example program starts the value of
integer memory i will be set to zero. The REPEAT and END_REPEAT statements define the loop. The
UNTIL statement defines when the loop must end. A line is present to increment the value of i for each
loop.

PROGRAM main
VAR Note: Allen Bradley does not implement
i : INT; the standard so that the programs can be
END_VAR written with text only. When program-
i := 0; ming in RSLogix, only the section indi-
REPEAT cated to the left would be entered. The
i := i + 1; variable ’i’ would be defined as a tag,
UNTIL i >= 10; and the program would be defined as a
END_REPEAT; task.
END_PROGRAM

Figure 261 A Structured Text Example Program

One important difference between ST and traditional programming languages is the nature of

You might also like