139
Inputting ST Programs Section 5-3
• Always use a space, carriage return, tab, or other token separator
between reserved words and variable names. Using token separators
between other token combinations is optional.
In the following example, the box (@) indicates where a space, carriage
return, tab, or other token separator is required.
Upper and Lower Case • Reserved words and variable names do not distinguish between upper
and lower case (either can be used).
Prohibited Characters for
Variable Names
• The following characters enclosed in square brackets cannot be used in
variable names.
• [!], ["], [#], [$], [%], [&], [`], [(],, [)], [-], [=], [^], [~], [\], [|], [@], [`], [[], [{], [;],
[+], [:], [*], []], [}], [,], [<], [.], [>], [/], [?]
• The numbers 0 to 9 cannot be used as the first character of variable
names.
• An underscore cannot be followed immediately by another underscore in
variable names.
• Spaces cannot be used in variable names.
An error message will occur if any of these characters are used in this way.
Operator Priority • Consider the operator priority in the structured text syntax, or enclose
operations requiring priority in parentheses.
Example: AND takes priority over OR. Therefore, in the example X OR Y
AND Z, priority will be given to Y AND Z.
STRING Data Type • The following text strings are supported:
Strings with up to 255 alphanumeric characters
The text strings are not case sensitive.
• Text strings defined in the ST language are stored in PLC memory as fol-
lows:
• Place text strings inside signal quotation marks.
• Two hexadecimal digits following a dollar sign ($) are interpreted as hexa-
decimal values.
IF@A>0THEN@X=10;
ELSE@
X:=0;
END_IF;
Notation Description
‘A’ Indicates the text string “A” (ASCII 41).
‘ ’ Indicates a text string containing a single space (ASCII 20).
‘’ Indicates an empty text string.
Notation Description
$02 The hexadecimal number 02 (start code)
$03 The hexadecimal number 03 (end code)
n
n+1
31 32
33 34
35 36
00 00
n+2
n+3
Data for the Text String "123456"
The null code (00) is stored
at the end of the text string.