→Literal
according to →IEC-standard: lexical unit that directly represents a value
Relating to →FBD-logic, a literal can be entered within a →value field.
Equivalents for TRUE" |
Equivalents for "FALSE" |
BOOL#TRUE |
BOOL#FALSE |
BOOL#1 |
BOOL#0 |
TRUE |
FALSE |
1 |
0 |
Description |
Examples |
integer |
0, 123_4, +986 |
base 2 (binary literal) |
2#1111_1111 (255 decimal), 2#1110_0000 (224 decimal) |
base 8 (octal literal) |
8#377 (255 decimal), 8#340 (224 decimal) |
base 16 (hexadecimal literal) |
16#FF or 16#ff (255 decimal), 16#E0 or 16#e0 (224 decimal) |
above possibilities as typed literal of type BYTE, WORD, DWORD or LWORD |
WORD#986, WORD#16#FF (255 decimal) |
BOOL is a bit string data type. But there are specific →Boolean literals.
Description |
Examples |
integer |
-12, 0, 123_4, +986 |
base 2 (binary literal) |
2#1111_1111 (255 decimal), 2#1110_0000 (224 decimal) |
base 8 (octal literal) |
8#377 (255 decimal), 8#340 (224 decimal) |
base 16 (hexadecimal literal) |
16#FF or 16#ff (255 decimal), 16#E0 or 16#e0 (224 decimal) |
above possibilities as typed literal of type SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT |
INT#-12, INT#16#FF (255 decimal) |
Description |
Examples |
Real literal |
0, 0.0, 0.4560, 3.14159_26 |
Real literal with exponent |
-1.34E-12, -1.34e-12 |
above possibilities as typed literal of type REAL or LREAL |
REAL#0.0, REAL#1.0E+6 |
You must enter duration data, such as days (d), hours (h), minutes (m), seconds (s) and fractions of a second (ms for milliseconds, us for microseconds, ns for nanoseconds) or any combinations of them, as shown in the following table. You can separate the duration units by underscore character. Moreover, you can enter the units in upper- or lowercase letters, for example s or S for seconds.
Description |
Examples |
Duration literals without underscore |
|
Short prefix |
T#14ms, T#14.7s, T#14.7m, T#14.7h, T#14.7d, T#14h12m, t#5d14h12m18s3.5ms |
Long prefix |
TIME#14ms, time#14h12m |
Duration literals with underscore |
|
Short prefix |
T#14h_12m, t#5d_14h_12m_18s_3.5ms |
Long prefix |
TIME#14h_12m, time#5d_14h_12m_18s_3.5ms |
Observe that your used →target system might influence the usage of duration literals in logi.CAD 3 (see "Properties and restrictions specific to the target system").
In case of date and time literal and time of day literal, the fractions of a second (entered after the .) are optional.
Description |
Examples |
Date literal |
|
Short prefix |
D#1984-06-25 |
Long prefix |
DATE#1984-06-25 |
Date and time literal |
|
Short prefix |
DT#1984-06-25-15:36:55.360_227_400 |
Long prefix |
DATE_AND_TIME#1984-06-25-15:36:55.360227400 |
Time of day literal |
|
Short prefix |
TOD#15:36:55.36 |
Long prefix |
TIME_OF_DAY#15:36:55.36 |
Observe that your used →target system might influence the usage of these literals in logi.CAD 3 (see "Properties and restrictions specific to the target system").
Single-byte character strings consist of zero or more characters prefixed and terminated by the single quote character '.
In contrast, logi.CAD 3 does not support double-byte character strings enclosed in the double quote character " for character string literals.
Single-byte character strings are:
Description |
Examples |
STRING literal |
'OK', 'ABCDEF' |
typed STRING literal |
STRING#'OK', STRING#'ABCDEF' |
CHAR literal |
'B', 'T' |
typed CHAR literal |
CHAR#'B', CHAR#'T' |
Three-character combination of the dollar sign ($) followed by two hexadecimal digits are interpreted in logi.CAD 3 as the corresponding character of the ANSI C character set.
This enables you to enter special characters, such as umlauts, for single-byte character string. Currently, such special characters are displayed in logi.CAD 3 (e.g. in the der Values of Variable view) as they have been entered.
Here a selection of special characters (a list of special characters and the corresponding hexadecimal digits is listed under https://www.ascii-code.com/):
Decimal value |
Hexadecimal digit |
To enter |
Special character |
128 |
80 |
$80 |
€ |
163 |
A3 |
$A3 |
£ |
169 |
A9 |
$A9 |
© |
174 |
AE |
$AE |
® |
177 |
B1 |
$B1 |
± |
178 |
B2 |
$B2 |
² (superscript "2") |
179 |
B3 |
$B3 |
³ (superscript "3") |
188 |
BC |
$BC |
¼ |
189 |
BD |
$BD |
½ |
190 |
BE |
$BE |
¾ |
196 |
C4 |
$C4 |
Ä |
214 |
D6 |
$D6 |
Ö |
220 |
DC |
$DC |
Ü |
223 |
DF |
$DF |
ß |
228 |
E4 |
$E4 |
ä |
246 |
F6 |
$F6 |
ö |
252 |
FC |
$FC |
ü |
If the character combination '$00' is assigned to a single character of a STRING variable, the character string of the STRING variable is terminated at this position. Such character strings are terminated in case of $00 in the Values of Variables view as well.
However, the complete character string is copied in assignments. This makes it possible to have the Values of Variables view display single characters behind $00, if you access the assigned characters behind $00.
Moreover, the following specifications are possible for single-byte character strings:
Specification |
Meaning |
'' |
empty string |
' ' |
string with space character |
'$'' |
string with single quote character ' |
'"' |
string with double quote character " |
Moreover, the following specifications are possible for two-character combinations in single-byte character strings:
Specification |
Meaning |
$' |
string with single quote character ' |
$$ |
string with dollar sign $ |
$L oder $l |
string with line feed |
$N oder $n |
string with newline |
$P oder $p |
string with form feed (page) |
$R oder $r |
string with carriage return |
$T oder $t |
string with tabulator |
Character string literals in pragmas consist of zero or more characters prefixed and terminated by the single quote character ' or by the double quote character ".
Description |
Examples |
literal with single quote |
'' (empty literal), 'OK', 'ABCDEF', 'B', ' ' (only a blank within the literal) |
literal with double quote |
"" (empty literal), "OK", "ABCDEF", "B", " " (only a blank within the literal) |
You are able to directly enter special characters, such as umlauts or €, but $ excepted, within the literal in ' as well as in ".
As alternative, you are able to enter the special characters as a three-character combination of the dollar sign ($) followed by two hexadecimal digits. This is analogous to the input within character string literals.
Examples:
Instead of "Änderung" or 'Änderung', you are able to enter "$C4nderung" or '$C4nderung'.
Instead of "€300" or '€300', you are able to enter "$80300" or '$80300'.
See the glossary article "→Character string literal" for more examples on these combinations and informative links.
Moreover, the following specifications are possible for character string literals in pragmas:
Specification |
Meaning |
Example |
'$'' |
in ': literal with single quote character ' |
'This is $'just$' a test.' |
'$"' |
in ': literal with double quote character " |
'This is $"just$" a test.' |
'"' |
in ': literal with double quote character " |
'This is "just" a test.' |
"'" |
in ": literal with single quote character ' |
"This is 'just' a test." |
"""" |
in ": literal with double quote character " |
"This is ""just"" a test." |
"$"" |
in ": literal with double quote character " |
"This is $"just$" a test." |
"$'" |
in ": literal with single quote character ' |
"This is $'just$' a test." |
Moreover, the following specifications are possible for character string literals in ' as well as in ":
Specification |
Meaning |
$$ |
literal with dollar sign $ |
$L or $l |
literal with line feed |
$N or $n |
literal with newline |
$P or $p |
literal with form feed (page) |
$R or $r |
literal with carriage return |
$T or $t |
literal with tabulator |
$0A |
literal as a three-character combination of the dollar sign ($) followed by two hexadecimal digit (e.g. for special characters – as mentioned above) |