Basics
46
Combination Interpretation when printed
$T or $t Tab ($09)
Examples of string literals
Example Explanation
'' Empty string (length 0)
'A' String of length 1 containing the single character A
' ' String of length 1 containing the space character
'$'' String of length 1 containing the single quote character
'$R$L' String of length 2 containing CR and LF characters
'$$1.00' String of length 5 which would print as "$1.00"
'$02$03' String of length 2 containing STX and ETX characters
Strings as constants
It is possible to enter values of the data type STRING directly as constants into a function or a function block.
The string must be enclosed in single quotes.
Transfer a constant character string 'abc' to the string variable sTarget.
Transferring strings to functions or function blocks
When character strings are transferred, only as many characters that fit into the target string are transferred.
Please refer to the following examples in the online help under the keyword 'STRING':
1. Copy a source string to a target string which is shorter.
2. Copy a constant character string to another which is shorter.
3. Generate a message using a string function.
NOTE
The conversion functions INT_TO_STRING (see page 217), DINT_TO_STRING (see page 220),
REAL_TO_STRING (see page 228), TIME_TO_STRING (see page 230), etc. need many system
resources in terms of programming steps and pro
cessing time. When you use these functions
frequently, create a user-defined function that embeds the conversion function and use the
user-defined function in your project. For older PLC types (FP0, FP3, FP5, FP10), this is also true
for the CONCAT (see page 269) and FIND (see page 273) instructions.
STRING with EN/ENO
Ladder diagram (LD) and function block diagram (FBD)
STRING instructions with enable input (EN) and enable output (ENO) contacts may NOT be connected to each