3 - 8 3 - 8
3 HANDLING OF CHARACTERS AND NUMERIC VALUES IN ST PROGRAMS
3.3 Data Representation Methods
Constants, labels and devices can be used as data in ST programs.
Item Description
Representation
Example
Constant
Numeric value or character string data written directly to
a program. It does not change during program execution.
123, “ABC”
Label
Data whose type and name are defined by the user.
Switch_A
Device
Device used by the QCPU (Q mode)/LCPU. It is
identified by the device name and device number.
X0, Y0, D100, J1\X0
3.3.1 Constants
Each constant is represented as described below in ST programs.
Data Type Numeric Notation
Representation Method
Example
TRUE • FALSE 1•0
M0 := TRUE;
Binary
The used binary number is preceded by "2#".
M0 := 2#0;
M0 := 2#1;
Octal
The used octal number is preceded by "8#".
M0 := 8#0;
M0 := 8#1;
BOOL
Hexadecimal
The used hexadecimal number is preceded
by "16#".
M0 := 16#0;
M0 := 16#1;
Binary
The used binary number is preceded by "2#".
D0 := 2#110;
Octal
The used octal number is preceded by "8#".
D0 := 8#377;
Decimal
The used decimal number is preceded by
"10#".
(The numeric value may be preceded by "K".)
D0 := 123;
D0 := K123;
INT
DINT
Hexadecimal
The used hexadecimal number is preceded
by "16#".
(The numeric value may be preceded by "H".)
D0 := 16#FF;
D0 := HFF;
REAL
The used real number is directly input.
(The numeric value may be preceded by "E".)
ABC := 2.34;
Rtest := E2.34;
STRING
A character string is enclosed by ' ' (or " ").
Stest := 'ABC';
Stest := “ABC”;
For the range that can be specified for each constant, refer to Section 3.2.1 Data types.
The following ranges apply to the areas that are not described in Section 3.2.1 Data types.
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......