38
6 ST LANGUAGE
6.1 Configuration
6.1 Configuration
Operators and syntaxes are used for programing in ST language.
A statement must end with ";" (semicolon).
Spaces, tabs, and line feeds can be inserted anywhere between an operator and data.
Comments can be inserted in a program.
Constituent elements of a program
A ST program consists of the following elements.
• Use one-byte delimiters, operators, and reserved words.
• For details of reserved words, refer to the following.
GX Works3 Operating Manual
Item Example Reference
Delimiter ;, ( ) Page 39 Delimiter
Operator +, -, <, >, = Page 39 Operator
Reserved word Syntax IF, CASE, WHILE, RETURN Page 40 Syntax
Device X0, Y10, M100 User's manual (Application)
Data type BOOL, DWORD Page 23 Data Type
Function ADD, REAL_TO_STRING_E Programming manual (Instructions, Standard
Functions/Function Blocks)
Constant 123, 'abc' Page 47 Constant
Label Switch_A Page 47 Label and device
Comment (* Turn ON *), //Turn ON, /*Turn ON*/ Page 48 Comment
Other symbols One-byte space, line feed code, tab code
intV2 := ABS(intV1);
IF M1 THEN
btn01 := TRUE;
ELSE
btn01 := FALSE;
END_IF;
Output_ENO := ENEG(btn01,Input1);
LadderFBInstance(Input1:=bool1,Input2:=bool2,Input3:=bool3);
(* user function block *)
Assignment statement
Conditional statement
Calling a function
Calling a function block
intV1 := 0 ;
intV2 := 2 ;
End of the statement
intV1 := 0 ;
intV2 :=
2 ;
Space
Tab
Line feed
intV1 := 0;
(* Substitution *)
intV2 := 2;
Comment