48
6 ST LANGUAGE
6 ST LANGUAGE
The ST language is one of the languages supported by IEC 61131-3, the international standard that defines the description
methods for logic. ST language is a text programming language with a grammatical structure similar to C language. ST
language is suitable for programming some complicated processing that cannot be easily described using ladder diagram.
ST language supports control syntaxes, operational expressions, function blocks (FBs), and functions (FUNs). Therefore, the
following description can be made.
Control syntaxes using selective branches with conditional statements and repetition by iteration statements
Expressions using operators (such as *, /, +, -, <, >, and =)
Calling a defined function block
Calling a standard function
(* Control conveyors of Line A to C. *)
CASE Line OF
1: Start_switch := TRUE; (* The conveyor starts. *)
2: Start_switch := FALSE; (* The conveyor stops. *)
3: Start_switch := TRUE; (* The conveyor stops with an alarm. *)
ELSE Alarm_lamp := TRUE;
END_CASE;
IF Start_switch = TRUE THEN (* The conveyor starts and performs processing 100 times. *)
FOR Count := 0
TO 100
BY 1 DO
Count_No := Count_No +1;
END_FOR;
END_IF;
D0 := D1* D2 + D3 / D4 -D5;
IF D0 > D10 THEN
D0 := D10;
END_IF;
//FB data name : LINE1_FB
//Input variable : I_Test
//Output variable : O_Test
//Input/output variable : IO_Test
//FB label name : FB1
FB1(I_Test :=D0,O_Test => D1,IO_Test := D100);
(* Convert BOOL data type to INT/DINT data type. *)
wLabel2 := BOOL_TO_INT (bLabel1);