Compiling an ST Program or ST Library
You can use the Build menu options to compile your ST program. The compilation feature is useful as it checks that your program has the correct syntax.
There are 2 compile options:
- Compile—Compiles the program. If the program is invalid, the compiler display provides a message that briefly describes the syntax error in your program. If the syntax is correct, the compiler displays a success message.
- Compile with Diagnostics—Compiles the program and provides detailed diagnostic information (the Logic in ST, the ST code formatted with indented text etc., and the op codes which is the machine code version of the ST code). As with the Compile option, there are messages for any errors in the syntax. If the syntax is correct, the compiler displays a success message.
The Compile with Diagnostics tool is useful when working with other types of Logic program that you want to use as ST programs. For example, you may find it easier to create a Function Block Diagram and then use the Compile with Diagnostics tool to access the ST code for the Function Block Diagram. You can then copy this code into an ST program (you have to remove the $ signs in the code).
To compile an ST program or ST library:
- Display the ST program or ST library in Design mode.
- Select the Build menu, then select the Compile option or the Compile with Diagnostics option as required.
The program or library is compiled and the compile messages are shown in the Compiler display.If there are syntax errors, you will need to alter the ST code. Typically, the causes of syntax errors are minor, such as the wrong type of value being specified or a missing semi-colon.
When you have successfully compiled your program, you can use the Debug option to check that its Logic defines the required behavior (see Debugging an ST Program).
If a database item's name includes parentheses ( ), you should ensure that each opening parenthesis is paired with a closing parenthesis. If this is not the case, any Logic programs that reference the database item will not compile successfully. For example, a point named "Analog Point (4" or "Analog Point (4))" will generate a compile error message. Multiple sets of parentheses will compile successfully, including nested parentheses. For example, a Logic program can refer to a point named "Analog Point (4)" or "Analog Point (4(x))". For more information, see Limitation for Database Item Names Referenced in Logic Programs in the ClearSCADA Guide to Logic.