Chapter 6 Structured Text Language - Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

6
STRUCTURED TEXT LANGUAGE
RnPCPU
RnPCPU
RnCPU RnENCPU
(Process)
(Redundant)
ST language is defined by International Standard IEC61131-3 that defines the logic description system. ST language is a text
language with a similar grammatical structure to C. This language is suitable for programming complicated processing that
cannot be easily described by ladder diagram.
This chapter describes the operation and specifications of the structured text language. For the operation
method of the engineering tool for creating an ST program, refer to the following.
 GX Works3 Operating Manual
The ST language supports control syntax, operational expressions, function blocks (FB), and functions (FUN), and can
describe them as shown below.
Ex.
Control syntax such as selective branches by conditional statements and repetitions by iteration statements
(*Control conveyors, 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;
Ex.
Expression using operators (*, /, +, -, <, >, =)
D0 := D1 * D2 + D3 / D4 - D5 ;
IF D0 > D10 THEN
D0 := D10;
END_IF;
Ex.
Calling function blocks that have been defined
//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 );
Ex.
Calling standard functions
(*Convert BOOL data type to INT/DINT data type.*)
wLabel2 := BOOL_TO_INT (bLabel1);
RnSFCPU RnSFCPU
(Standard)
(Safety)
6 STRUCTURED TEXT LANGUAGE
6
59

Advertisement

Table of Contents
loading

Table of Contents