Download system overview - People(dot)tuke(dot)sk

Transcript
B&R Automation Studio™
9. Structured Text
Logic Compare Expressions
Symbol Logic Compare Expressions
Example
=
Equal to
IF a = b THEN ...
<>
Not equal to
IF a <> b THEN ...
>
Greater than
IF a > b THEN ...
>=
Greater than or equal to
IF a >= b THEN ...
<
Less than
IF a < b THEN ...
<=
Less than or equal to
IF a <= b THEN ...
Conditions
Conditions
Example
Description
a := b * c;
Calculation
Start
IF
THEN
IF a > 0 THEN
result := 1;
ELSIF
ELSIF a = 0 THEN
Condition fulfilled
Check against 2nd cond
Value := 100;
ELSE
ELSE
result:= 0;
END_IF
no condition required
End of the entscheidun
END_IF
Case Statement
Case
CASE
OF
Example
Description
CASE Position OF
Start
Display := OVERVIEW;
1:
1:
2,5:
2,5: Display := NoT_SUPPORTED; only valid for position 2 or 5
6..10:
6..10: Display := SETVALUE;
Valid for pos. 6 to 10
11..20:
11..20: Display := ACTVALUE;
Valid for pos. 11 to 20
ELSE
ELSE Display := ERROR;
All other positions
END_CASE
END_CASE
only for first position
End of the CASE statement
Training ASINT
Page 9.36