Edit an ST Program
To enter the code for an ST program, you need to edit as ST Program database item. During the editing process, you will enter the code that defines the behavior that is to be provided by the program, for example, you could enter the code that allows the ST program to perform a calculation. When you save the code, the program you have created is stored in the ST Program database item.
To edit an ST program:
- In the Database Bar, either double-click on an ST program item or right-click on it and select the Edit Structured Text Programoption from the context sensitive menu.
The ST program is displayed in Design mode. You can only edit an ST program in Design mode.
The main display area of the ST program editor shows the ST program. Each ST program has
PROGRAM <program name>
;
END_PROGRAM
by default as ST programs require these. You will define the Logic of your ST program between PROGRAM and END_PROGRAM.
At the bottom of the ST program editor is a smaller frame. This frame is the compiler. ClearSCADA displays diagnostic information in this section.
To code an ST program, you will need an understanding of the Structured Text language. We explain some of the basic principles of the ST language in the following sections, but you may need to broaden your knowledge by referring to a Third Party source:
- Understanding the Basic Structure of an ST Program
- Entering a Comment
- Internal Variables
- Direct Variables
- Indirect Variables
- Constants
- Setting the Default Values
- Built-In Data Types
- Derived Data Types
- Executing Methods on Database Items
- Controlling the Flow of the Program
- Using an ST Program to Call an SQL Query
- Inserting, Updating, and Deleting Values by Using SQL in an ST Program
- Passing Multiple Parameters into an SQL Query in an ST Program
- Function Blocks in ST Programs
- Using Libraries in ST Programs.
The following sections explain how to check that your ST program is coded correctly:
- Compiling an ST Program or ST Library
- Debugging an ST Program
- Viewing the Variables in your ST Program.
The following section explains how to configure your ST program (including how to define when the program is executed):