TM246TRE.00-ENG - Structured Text (ST) - V3090 PDF
TM246TRE.00-ENG - Structured Text (ST) - V3090 PDF
Structured Text
Prerequisites and requirements
Training modules TM210 Working with Automation Studio
TM213 Automation Runtime
TM223 Automation Studio Diagnostics
Software Automation Studio 3.0.90 or higher
Hardware None
TABLE OF CONTENTS
1 INTRODUCTION.................................................................................................................................. 4
1.1 Learning objectives................................................................................................................. 4
2 GENERAL INFORMATION.................................................................................................................. 5
2.1 Features of Structured Text.................................................................................................... 5
2.2 Editor functions....................................................................................................................... 6
3 BASIC ELEMENTS.............................................................................................................................. 8
3.1 Expressions............................................................................................................................. 8
3.2 Assignments............................................................................................................................ 8
3.3 Source code documentation: Comments................................................................................9
3.4 Order of operations...............................................................................................................10
3.5 Reserved keywords...............................................................................................................11
4 COMMAND GROUPS........................................................................................................................12
4.1 Boolean operations............................................................................................................... 12
4.2 Arithmetic operations............................................................................................................ 13
4.3 Comparison operators and decisions................................................................................... 16
4.4 State machine - CASE statement.........................................................................................19
4.5 Loops.....................................................................................................................................20
5 FUNCTIONS, FUNCTION BLOCKS AND ACTIONS........................................................................ 27
5.1 Calling functions and function blocks................................................................................... 27
5.2 Calling actions.......................................................................................................................29
6 ADDITIONAL FUNCTIONS, AUXILIARY FUNCTIONS..................................................................... 30
6.1 Pointers and references........................................................................................................30
6.2 Preprocessor for IEC programs............................................................................................ 30
7 DIAGNOSTIC FUNCTIONS............................................................................................................... 31
8 EXERCISES....................................................................................................................................... 32
8.1 Exercise - Box lift..................................................................................................................32
9 SUMMARY......................................................................................................................................... 33
10 APPENDIX........................................................................................................................................34
10.1 Arrays.................................................................................................................................. 34
10.2 Exercise solutions............................................................................................................... 37
1 INTRODUCTION
Structured Text is a high-level programming language. Its basic concept includes elements taken from
the languages BASIC, Pascal and ANSI C. With its easy-to-understand standard constructs, Structured
Text (ST) is a fast and efficient way of programming in the field of automation.
The following chapters will introduce you to the commands, keywords and syntax used in Structured
Text. Simple examples will give you a chance to use put these concepts into practice to make it easier
for you to understand them.
This training module uses selected exercises to help you learn the basics of high-level language pro-
gramming with Structured Text (ST).
You will learn about the high-level language editor and Automation Studio's SmartEdit features.
You will learn the basic elements used in high-level language programming, as well as how to
use ST commands.
You will learn how to use command groups and arithmetic functions.
You will learn how to use comparison and Boolean operators.
You will learn how to call the elements used to control program flow.
You will learn how to work with reserved keywords.
You will learn the difference between actions, functions and function blocks, as well as how to
use them.
You will learn how to use the diagnostic functions available for high-level language program-
ming.
2 GENERAL INFORMATION
General information
ST is a text-based, high-level language for programming automation systems. Its simple standard con-
structs make programming fast and efficient. ST uses many traditional features of high-level languages,
including variables, operators, functions and elements for controlling program flow.
The ST programming language is standardized in accordance with the IEC1
Features
Structured Text is characterized by the following features:
High-level, text-based language
Structured programming
Easy-to-use standard constructs
Fast and efficient programming
Self-explanatory and flexible
Similar to Pascal
Conforms to the IEC 61131-3 standard
Possibilities
Automation Studio supports the following functions:
Digital and analog inputs and outputs
Logical operations
Logical comparison expressions
Arithmetic operations
Decisions
Step switching mechanisms
Loops
Function blocks
Dynamic variables
Calling actions
Integrated diagnostics
1 The IEC 61131-3 standard is a worldwide applicable standard for programming languages used on program-
mable logic controllers. In addition to Structured Text, other programming languages such as Sequential
Function Chart, Ladder Diagram, Instruction List, and Function Block Diagram are defined.
The editor is a text editor with many additional functions. Commands and keywords are shown in color.
Areas can be expanded and collapsed. Autocomplete is available for variables and constructs (SmartE-
dit).
The editor for variable declaration supports the initialization of variables, constants, user data types and
structures. In addition, the used variables can be commented on and documented in doing so. The
declaration editors also support SmartEdit features.
3 BASIC ELEMENTS
The following section describes the basic elements of ST in more detail. Expressions, assignments, the
use of comments in the program code and reserved keywords, among others, are explained.
3.1 Expressions
An expression is a construct that returns a value after it has been calculated. Expressions consist of
operators and operands. An operand can be a variable, constant or function call. Operators are used to
connect the operands (3.4 "Order of operations"). Every expression must be ended in a semicolon (";"),
regardless of it concerning a function call or an assignment.
b + c;
(a - b + c) * COS(b);
SIN(a) + COS(b);
Table 1: Examples of expressions
3.2 Assignments
Assignments consists of a variable on the left side which is assigned the result of a calculation or ex-
pression on the right side using the assignment operator ":=". All assignments must be completed with
a semicolon ";".
When this line of code is executed, the value of the "Result" variable is twice the value of the
"ProcessValue" variable.
Result := ProcessValue.1;
Table 3: Accessing the second bit of "ProcessValue"
Comments are an important part of source code. They describe the code and make it more understand-
able and readable. Comments make it possible for you or others to understand a program long after it
has been completed. They are not compiled and have no influence on program execution. Comments
must be placed between a pair of parenthesis and asterisks, e.g. (*comment*).
An additional comment form is introduced with "//". Several lines can be selected in the editor and com-
mented out with one of the icons in the toolbar. This variant is an expansion to the existing IEC standard.
The use of different operators brings up the question of priority. The priority of the operators is important
when solving an expression.
Expressions are solved by taking the operators with the highest priority into account first. Operators with
the same priority are executed from left to right as they appear in the expression.
Operator Syntax
Braces () Highest priority
Function call Call(Argument)
Exponent **
Negation NOT
Multiplication, division, modulo operator *, /, MOD
Addition, subtraction +, -
Comparisons <, >, <=, >=
Equality comparisons =, <>
Boolean AND AND
Boolean XOR XOR
Boolean OR OR Lowest priority
The resolution of the expression is performed by the compiler. The following examples show that different
results can be achieved through the use of parentheses.
The expression is executed from left to right. The operations in parentheses are executed be-
fore the multiplication since the parentheses have higher priority. You can see that using paren-
theses can lead to different results.
In programming, all variables must adhere to certain naming conventions. In addition, there
are reserved keywords that are already recognized as such by the editor and are shown in a
different color. These cannot be used a variables.
The libraries OPERATOR and AsIecCon are a standard part of new projects. The functions
they contain are IEC functions that are interpreted as keywords.
In addition, the standard also defines literals for numbers and character strings. This makes it
possible to represent numbers in different formats.
4 COMMAND GROUPS
The following command groups are the basic constructs of high-level language programming. These
constructs can be flexibly combined and nested within one another.
They can be categorized according to the following command group categories:
4.1 "Boolean operations"
4.2 "Arithmetic operations"
4.3 "Comparison operators and decisions"
4.4 "State machine - CASE statement"
4.5 "Loops"
Boolean operators can be used to link variable values at the binary level. NOT, AND, OR and XOR are
differentiated between. The operands do not necessarily have to be of data type BOOL. However, the
order of operations should be considered. Brackets can be used.
Boolean operations can be combined in any way. Additional sets of parentheses increase program read-
ability and ensure that the expression is solved correctly. The only possible results of the expression are
TRUE (logical 1) or FALSE (logical 0).
Parentheses are not needed since NOT has a higher priority than AND. Nevertheless, it is
always a good idea to use parentheses to make the program clearer.
doValveSilo1 := (diSilo1Up) AND (NOT doValveSilo2) AND (NOT
doValveSilo3);
Table 8: Implementation with Boolean connectives, but with brackets
A key advantage of high-level programming languages is their easy handling of arithmetic operations.
The data type of variables and values is always crucial to calculations. The result is calculated on the
right side of the expression and only then assigned to the corresponding variable. The result depends
on the data types and syntax (notation) being used. The following table illustrates this.
Data types
Expression / Syntax Results
Result Operand1 Operand2
Result := 8 / 3; INT INT INT 2
Result := 8 / 3; REAL INT INT 2.0
Result := 8.0 / 3; REAL REAL INT 2.66667
Result := 8.0 / 3; INT REAL INT *Error
Table 10: Performed by the compiler implicitly convert
The resulting value "*Error" stands for the following compiler error message "Error 1140: Incom-
patible data types: Cannot convert REAL to INT.". This is because it is not possible to
assign the expression to this particular data type.
When programming, one is inevitably confronted with different data types. In principle, one can mix data
types within a program. Assignment of different data types is also possible. Nevertheless, you should
be caution with this.
Even if implicit data type conversion is carried out, it's still possible that an incorrect result
will occur depending on the compiler and what's being converted. One danger here involves
assigning an unsigned value to a signed data type.
This can lead to an overflow error when adding or multiplying. This depends on the platform
being used, however. The compiler does not issue a warning in this case.
All variable declarations are listed in IEC format. Variable declarations can be entered in this
format in the text view of the .var file for the respective program.
Here there is the danger of an overflow error when the addition takes place:
VAR
TotalWeight: INT;
Declaration: Weight1: INT;
Weight2: INT;
END_VAR
In this case, the data type for the result must have enough space to hold the sum of the addi-
tion operation. As a result, a larger data type is necessary. When adding, at least one of the
operands must be converted to the larger data type. The conversion of the second operand is
then handled implicitly by the compiler.
VAR
TotalWeight: DINT;
Declaration: Weight1: INT;
Weight2: INT;
END_VAR
Program code: TotalWeight := INT_TO_DINT (Weight1) + Weight2;
Table 13: Overflow errors can be prevented by using explicit conversion.
On 32-bit platforms, the operands being calculated are converted to 32-bit values. In this case,
adding does not cause an overflow error.
Programming \ Variable and data types \ Data types \ Basic data types
Programming \ Libraries \ IEC 61131-3 functions \ CONVERT
Programming \ Editors \ Text editors
Programming \ Editors \ Table editors \ Declaration editors \ Variable declaration
Exercise: Aquarium
The temperature of an aquarium is measured at
two different places. Create a program that calcu-
lates the average temperature and passes it along
to an analog output. Don't forget that analog inputs
and outputs must be of data type INT.
Figure 5: Aquarium
VAR
aiTemp1: INT;
Declaration: aiTemp2: INT;
aoAvgTemp: INT;
END_VAR
Table 14: Suggestion for variable declaration
In Structured Text, simple constructs are provided to compare variables. They return either the value
TRUE or FALSE. Comparison operators and logical operations are mainly used as conditions in state-
ments such as IF, ELSIF, WHILE and UNTIL.
Decisions
The IF statement is used to handle decisions in the program. You already know the comparison opera-
tors. These can be used here.
Comparison expressions can be combined with Boolean operators so that multiple conditions can be
tested simultaneously.
Explanation: If "a" is greater than "b" and if "a" is less than "c", then "Result" is
equal to 100.
IF (a > b) AND (a < c) THEN
Program code: Result := 100;
END_IF;
Table 18: Using multiple comparison expressions
An IF statement can also include additional nested IF statements. It is important that there are not too
many nesting levels as this has a tendency to make the program too confusing.
The SmartEdit feature of the editor can be used to enter information more easily. If you want
to insert an IF statement, simply type in "IF" and then press the <TAB> key. This automatically
adds the basic structure of the IF statement in the editor.
Figure 8: Thermometers
A variable of data type STRING is needed to output the text. The assignment can look like this:
sShowText := 'COLD';
If several IF statements are checking the same variable, then it's useful to think about whether
using a CASE statement might be a better, clearer solution.
The CASE statement has an additional advantages over the IF statement in that comparisons
only have to be made once, making the program code more effective.
The CASE statement compares a step variable with multiple values. If one of the comparisons matches,
the statements that are associated with that step are executed. If none of the comparisons match, then
the program code under the ELSE statement is executed, as is the case with the IF statement.
Depending on the application, the CASE statement can be used to set up state machines or automata.
Only one step of the CASE statement is processed per program cycle.
The step variable must be a integer data type (e.g. USINT, UINT, UINT).
Instead of fixed numerical values, constants or elements of enumerated data types should be
used in the program code. Replacing a value with text makes the program code must easier to
read. In addition, if these values need to be changed in the program, then the only change that
needs to take place is in the declaration itself, not in the program code.
The level of liquid in the tank is read as an analog value (0 - 32767) and
is converted internally to a percentage value (0-100%).
A warning tone should be given if the contents fall below 1%. Create a
solution using the CASE statement.
VAR
aiLevel : INT;
PercentLevel : UINT;
doLow : BOOL;
Declaration:
doOk : BOOL;
doHigh : BOOL;
doAlarm : BOOL;
END_VAR
Table 19: Suggestion for variable declaration
4.5 Loops
In many applications, it is necessary for sections of code to be executed repeatedly during the same
cycle. This type of processing is referred to as a loop. The code in the loop is executed until a defined
termination condition is met.
Loops are used to make programs clearer and shorter. The ability to expand the program's functionality
is also an issue here.
Depending on how a program is structured, it is possible that an error will prevent the program from
leaving the loop until the CPU's time monitoring mechanism intercedes. To avoid such infinite loops,
always provide a way to terminate the loop after a specified number of repetitions.
There are two main types of loops: those where loop control begins at the the top and those where it
begins at the bottom.
Loops where control begins at the top (FOR, WHILE) check the termination condition before entering
the loop. Loops where control begins at the bottom (REPEAT) check the condition at the end of the loop.
These will always be cycled through at least once.
The FOR statement is used to execute a program section for a limited number of repetitions. WHILE and
REPEAT loops are used for applications where the number of cycles is not known in advance.
Keywords Syntax
FOR .. TO .. BY2 .. DO FOR i:= StartVal TO StopVal BY Step DO
Res := Res + 1;
END_FOR END_FOR
Table 20: Elements of the FOR statement
The loop counter "index" is pre-initialized with the start value "Start-
Val". The loop is repeated until the value of the terminating variable FOR
"StopVal" is reached. Here, the loop counter is always increased by
1, known as the "BY step". If a negative value is used for the "step"
increment, then the loop will count backwards.
Index := StartVal
The loop counter, the start value and the end value must all have the
same data type. This can be achieved by explicit data conversion
(4.2.1 "Data type conversion").
Statement (s )
Yes
Increase Index
END_FOR
VAR
aWeights : ARRAY [0..4] OF INT;
iCnt : USNT;
Declaration:
sumWeight : DINT;
avgWeight : INT;
END_VAR
Table 21: Suggestion for variable declaration
Arrays are required for solving this exercise. Further information on arrays can be found in the
appendix or in Automation Studio.
Where possible, use array declarations for the loads and constants to limit the loop's end values.
This considerably improves the readability of declarations and programs. Making changes later
also becomes much easier.
Programming \ Programs \ Variables and data types \ Data types \ Composite data types \
Arrays
See 10.1 "Arrays" on page 34
VAR CONSTANT
Declaration: MAX_INDEX : INT := 4;
END_VAR
Table 22: Suggestion for variable declaration
Unlike the FOR statement, WHILE loops do not rely on a loop counter. This type of loop is executed as
long as a condition or expression is TRUE. It is important to ensure that the loop has an end so that a
cycle time violation does not occur at runtime.
Keywords Syntax
WHILE .. DO WHILE i < 4 DO
Res := value + 1;
i := i + 1;
END_WHILE END_WHILE
Table 23: Executing a WHILE statement
A REPEAT loop is different from the WHILE loop as the termination condition is checked only after the
loop has executed. This means that the loop runs at least once, regardless of the termination condition.
Keywords Syntax
REPEAT REPEAT
(*program code*)
i := i + 1;
UNTIL UNTIL i > 4
END_REPEAT END_REPEAT
Table 24: Executing a REPEAT statement
The EXIT statement can be used in all of the different types of loops before the termination condition is
met. If EXIT is executed, the loop is terminated.
Keywords Syntax
REPEAT
IF setExit = TRUE THEN
Keywords Syntax
EXIT EXIT;
END_IF
UNTIL i > 5
END_REPEAT
Once the EXIT statement in the loop has been executed, the loop
is terminated, regardless of whether the termination condition or the
loop's ending value of the loop has been reached. In nested loops,
only the loop containing the EXIT statement is terminated.
VAR
Declaration: aValues : ARRAY[0..99] OF INT;
END_VAR
The individual elements of arrays can either be pre-initialized with values in the program code
or in the variable declaration window.
Various functions and function blocks extend the functionality of a programming language. Actions are
used to structure the program more effectively. Functions and function blocks can be inserted from the
toolbar.
Figure 16: Inserting functions and function blocks from the toolbar
Functions
Functions are subroutines that return a particular value when called. One way a function can be called is
in an expression. The transfer parameters, also referred to as arguments, are the values that are passed
to a function. They are separated by commas.
VAR
sinResult : REAL;
Declaration:
xValue : REAL;
END_VAR
xValue := 3.14159265;
Program code:
sinResult := SIN(xValue);
Table 25: Calling a function with one transfer parameter
Function blocks
A function block is characterized by the fact that it can take on several transfer parameters and return
multiple results.
When calling a function block, it is possible to pass all arguments or just some of them. Parameters and
results can be accessed in the program code using the elements of the instance variable.
VAR
diButton : BOOL;
Declaration: doBell : BOOL;
TON_Bell : TON;
END_VAR
TON_bell(IN := diButton, PT := T#1s);
Call variant 1:
doBell := TON_bell.Q;
(*-- Parameters*)
TON_bell.IN := diButton;
TON_bell.PT := T#1s
Call variant 2: (*-- Call function block*)
TON_bell();
(*-- Read results*)
doBell := TON_bell.Q;
Table 26: Debouncing a button with the TON() function block
In the call for variant 1, all parameters are passed directly when the function block is called. In the call
for variant 2, the parameters are assigned to the elements of the instance variable. In both cases, the
desired result must be read from the instance variable after the call has taken place.
A detailed description of library functions can be found in the Automation Studio help system.
Pressing <F1> opens the help documentation for the selected function block.
Many libraries also include different application examples that can be imported directly into the
Automation Studio project.
An action is program code that can be added to programs and libraries. Actions are an additional pos-
sibility for structuring programs and can also be formulated in a programming language other than the
program which calls it. Actions are identified by their names.
Calling an action is very similar to calling a function. The difference is that there are no transfer parame-
ters and a value is not returned.
If you use a CASE statement to control a complex sequence, for example, the contents of the
individual CASE steps can be transferred on to actions. This keeps the main program compact.
If the same functionality is needed elsewhere, then it's as easy as calling the action again.
CASE Sequence OF
WAIT:
IF cmdStartProc = 1 THEN
Sequence := STARTPROCESS;
END_IF
STARTPROCESS:
acStartProc; (*machine startup*)
Program:
IF Process_finished = 1 THEN
Sequence := ENDPROCESS;
END_IF
ENDPROCESS:
acEndProc; (*machine shutdown*)
(*...*)
END_CASE
ACTION acStartProc:
(*Add your sequence code here*)
Action:
Process_finished := 1;
END_ACTION
Table 27: Calling actions in the main program
Actions
To extend the functionality of the existing IEC standard, B&R also offers pointers in ST. This allows a
dynamic variable to be assigned a particular memory address during runtime. This procedure is referred
to as referencing or the initialization of a dynamic variable.
Once the dynamic variable is initialized, it can be used to access to the contents of the memory address
it is "pointing" to. For this operation, the keyword ACCESS is used.
VAR
iSource : INT;
Declaration:
pDynamic : REFERENCE TO INT;
END_VAR
pDynamic ACCESS ADR(iSource);
Program code:
(*pDynamic reference to iSource*)
Table 28: Referencing a pointer
Extended IEC standard functionality can be enabled in the project's settings in Automation
Studio.
In text-based programming languages, it is possible to use preprocessor directives. With regard to syn-
tax, the statements implemented broadly correspond to those of the ANSI C preprocessor.
These preprocessor commands are an IEC expansion. They must be enabled in the project settings.
Preprocessor directives are used for the conditional compilation of programs or entire configurations.
When turned on, compiler options enable functionality that affects how the compilation process takes
place.
A description and full list of available commands can be found in the Automation Studio help system.
Project management \ The workspace \ General project settings \ Settings for IEC compliance
Programming \ Programs \ Preprocessor for IEC programs
7 DIAGNOSTIC FUNCTIONS
Comprehensive diagnostic tools make the entire programming process more efficient. Automation Studio
includes several tools for troubleshooting high-level programming languages:
Monitor mode
Watch window
Line coverage
Tooltips
Debuggers
Cross reference
8 EXERCISES
9 SUMMARY
Structured Text is a high-level programming language that offers a wide range of functionality. It contains
everything necessary to create an application for handling a particular task. You now have an overview
of the constructs and capabilities possible in ST.
The Automation Studio help documentation contains a description of all of these constructs. Remem-
ber, this programming language is especially powerful when using arithmetic functions and formulating
mathematical calculations.
10 APPENDIX
10.1 Arrays
Unlike variables of a primitive data type, arrays are comprised of several variables of the same data
type. Each individual element can be accessed using the array's name and an index value.
The index used to access values in the array may not fall outside of the array's actual size. The size of
an array is defined when the variable is declared.
In the program, the index can be a fixed value, a variable, a constant or an enumerated element.
Figure 19: An array of data type INT with a range of 0 to 9 corresponds to 10 different array elements.
Declaration VAR
aPressure : ARRAY[0..9] OF INT := [10(0)];
END_VAR
Program code (*Assigning the value 123 to index 0*)
aPressure[0] := 123;
Table 29: Declaring an array of 10 elements, starting index = 0
If attempting to access an array element with index 10, the compiler outputs the following error
message:
If an array of 10 elements should be declared, it can be done in the declaration editor with either
"USINT[0..9]" or "USINT[10]". In both of these cases, an array with a starting index of 0 and a
maximum index of 9 will be created.
The array should contain 10 elements. The smallest array index is 0. The data type must be INT.
Use the index to access the array in the program code. Use fixed numbers, constants and a variable
for this.
Access index value 10 of the array and then analyze the output in the message window.
When assigning aPressure[10] := 123;, the compiler reports the following error message.
Error 1230: The constant value '10' is not in range '0..9'.
The compiler is not able to check array access if the assignment is made using a variable.
index := 10;
aPressure[index] := 123;
The program code has now been updated so that the index used to access the array is limited
to the maximum index of the array. An advantage of this is that arrays can be resized (larger
or smaller) without having to make a change in the program code.
Programming \ Variables and data types \ Data types \ Composite data types \ Arrays
The data type of the average value must be the same as the data type of the array (INT).
A constant that is already being used to determine the array size for the declaration of an array
variable can also be used as end value for the loop. When generating the average, the same
constant can also be used for division. A data type that is larger than the output data type (e.g.
DINT) must be used when adding up the individual array elements. The resulting value can then
be converted back to the INT data type using an explicit data type conversion.
Multi-dimensional arrays
Arrays can also be composed of several dimensions. The declaration and usage in this case can look
something like this:
Declaration VAR
Array2Dim : ARRAY [0..6,0..6] OF INT;
END_VAR
Program (*counting from 0*)
code Arry2Dim[2,2] := 11;
An invalid attempt to access an array in the program code using a fixed number, a constant or
an enumerated element will be detected and prevented by the compiler.
An invalid attempt to access an array in the program code using a variable cannot be detected
by the compiler and may lead to a memory error at runtime. Runtime errors can be avoided by
limiting the array index to the valid range.
The IEC Check library can be imported into an Automation Studio project to help locate runtime errors.
Exercise: Aquarium
VAR
aiTemp1 : INT;
Declaration: aiTemp2 : INT;
aoAvgTemp : INT;
END_VAR
aoAvgTemp := DINT_TO_INT((INT_TO_DINT(aiTemp1)
Program code:
+ aiTemp2) / 2);
Table 34: Explicit data type conversion before addition and after division
CASE PercentLevel OF
Program code:
0: (*-- Level alarm*)
doAlarm := TRUE;
1..24: (*-- level is low*)
doLow := TRUE;
25..90:(*-- level is ok*)
doOk := TRUE;
ELSE (*-- level is high*)
doHigh := TRUE;
END_CASE
Table 37: CASE statement for querying values and value ranges
VAR
(*-- Digital outputs*)
doConvTop: BOOL;
doConvBottom: BOOL;
doConvLift: BOOL;
Declaration: doLiftTop: BOOL;
doLiftBottom: BOOL;
doLiftUnload: BOOL;
(*-- Digital inputs*)
diConvTop: BOOL;
diConvBottom: BOOL;
diLiftTop: BOOL;
diLiftBottom: BOOL;
diLiftUnload: BOOL;
diBoxLift: BOOL;
(*-- Status variables*)
selectLift: UINT;
ConvTopOn: BOOL;
ConvBottomOn: BOOL;
END_VAR
Table 41: Possible solution to the box lift exercise
TRAINING MODULES