40
4 LABELS
4.6 Constant
4.6 Constant
Types of constants
The following table shows the expressions for setting a constant to a label.
*1 In the binary notation, the octal notation, the decimal notation, the hexadecimal notation, and the real number notation, values can be
delimited by an underscore (_) to make programs easy to read. (In the program processing, underscores are ignored.)
When "$" is used in character string type data
"$" is used as an escape sequence. Two hexadecimal numbers after "$" are recognized as an ASCII code, and characters
corresponding to the ASCII code are inserted in the character string. If no ASCII code for the two hexadecimal numbers after
"$" exists, a conversion error occurs. However, when any of the following characters is described after "$", no error occurs.
Applicable data type Type Expression Example
Bit Boolean data Input "TRUE" or "FALSE". TRUE, FALSE
Binary Append "2#" in front of a binary number. 2#0, 2#1
Octal Append "8#" in front of an octal number. 8#0, 8#1
Decimal Directly input a decimal number, or append "K" in front of a
decimal number.
0, 1, K0, K1
Hexadecimal Append "16#" or "H" in front of a hexadecimal number. 16#0, 16#1, H0, H1
• Word [Unsigned]/Bit String [16-bit]
• Double Word [Unsigned]/Bit String [32-
bit]
• Word [Signed]
• Double Word [Signed]
Binary
*1
Append "2#" in front of a binary number. 2#0010, 2#01101010,
2#1111_1111
Octal
*1
Append "8#" in front of an octal number. 8#0, 8#337, 8#1_1
Decimal
*1
Directly input a decimal number or append "K" in front of a
decimal number.
123, K123, K-123,
12_3
Hexadecimal
*1
Append "16#" in front of a hexadecimal number.
Or append "H" in front of a value.
16#FF, HFF, 16#1_1
FLOAT [Single Precision] Real number
*1
Directly input a real number, or append "E" in front of a real
number.
2.34, E2.34, E-2.34,
3.14_15
Real number
(exponent
expression)
Append "E" in front of an exponent expression or a real number.
Append "+" in front of exponent part.
1.0E6, E1.001+5
String(32) Character string Enclose a character string with single quotations ('). 'ABC'
Time Time Append "T#" in front. T#1h,
T#1d2h3m4s5ms
Expression Symbol that is used in character string, or printer code
$$ $
$' '
$'' ''
$L or $l Line feed
$N or $n Newline
$P or $p Page (form feed)
$R or $r Return
$T or $t Tab