Академический Документы
Профессиональный Документы
Культура Документы
Structured Text
Objectives
After this chapter you should be able to:
Describe the Structured Text Language rules
Write simple application code in ST
Use Functions and Function Blocks in ST
Reference Documentation
3BSE043732 IndustrialIT 800xA Control and I/O
Application Programming Introduction and Design
3BSE035980 IndustrialIT 800xA Control and I/O
Basic Control Software Introduction and Configuration
3BSE035981 IndustrialIT 800xA Control and I/O
Extended Control Software Binary and Analog Handling
ABB University - 2
Revision C
Structured Text
Structured Text
Language Elements
Functions and Function Blocks
Common Mistakes and Error Messages
Change Language in Online
ABB University - 3
Revision C
Language
Elements Advantages
Structured Text (ST) is a high-level programming language
Operator Description
:= Assigns a value (number, logical or string) to a variable
Operator Description
(**) Comment according to IEC 1131-3.
OR Boolean OR.
Operator Description
** Exponential, i.e. raising to the power.
* Multiplication
/ Division.
+ Addition.
- Subtraction.
MOD Modulus.
Operator Description
< Less than.
= Equal to.
Revision C
or Boolean OR Lowest
ABB University - 8
Revision C
Language
Elements Conditional Statements
Operator Description
IF Boolean Expression THEN If (and only If) the Boolean Expression evaluates
Statement(s); to True, then the Statement(s) between the IF and
END_IF; END_IF is/are executed.
Operator Description
CASE Integer Expression OF A statement is executed depending on the value of
Integer Literal1 : Statement(s); an integer variable or an integer expression.
END_CASE; The <integer literal> is one or several integer
values or one or several ranges of values.
CASE Integer Expression OF In this example, three values are tested and the
Integer Literal1 : Statement(s); appropriate statements) executed. One variation is
Integer Literal2 : Statement(s); to permit a range of values to be tested rather than
ABB University - 9
WHILE Level > 80.0 DO The WHILE statement is used in order to allow a statement
Statement(s); (or statements) to be executed repeatedly while a certain
END_WHILE; condition is True.
This separates it from the FOR statement. It has some
similarities with the REPEAT statement.
Language Elements
Functions and Function Blocks
Common Mistakes and Error Messages
Change Language in Online
ABB University - 11
Revision C
Functions and
Function Blocks Overview
ABB University - 12
Revision C
Functions and
Function Blocks Declare Function Block Instances
Absolute minimum = Name and function block Type
ABB University - 13
Revision C
Functions and
Function Blocks Call a Function Block Instance (1)
ABB University - 14
Revision C
Functions and
Function Blocks Call a Function Block Instance (2)
ABB University - 15
Revision C
Structured Text
Structured Text
Language Elements
Functions and Function Blocks
Common Mistakes and Error Messages
Change Language in Online
ABB University - 16
Revision C
Common
Mistakes Identifier, constant or opening parenthesis
ABB University - 17
Revision C
Common
Mistakes Variable name is not unique
ABB University - 18
Revision C
Common
Mistakes Identifier too long or invalid
ABB University - 19
Revision C
Common
Mistakes Undefined function block
ABB University - 20
Revision C
Common
Mistakes Type mismatch in assignment
ABB University - 21
Revision C
Common
Mistakes Incompatible types in expression
ABB University - 22
Revision C
Structured Text
Structured Text
Language Elements
Functions and Function Blocks
Common Mistakes and Error Messages
Change Language in Online
ABB University - 23
Revision C
Change
Language Change from ST to FBD in Online
ABB University - 24
Revision C
ABB University - 25
Revision C