Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual page 155

Function blocks
Table of Contents

Advertisement

Structured Text (ST Language) Specifications
Note: Nesting in comments is not possible, i.e., (*(*this type of nesting is not supported*)*)
Spaces, Carriage Returns, Tabs
• Any number of spaces, carriage returns, and tabs, or combinations of these can be used anywhere within
statements. Therefore, use spaces, carriage returns, and tabs between reserved words and equations to
make them easier to read.
• Spaces, carriage returns, and tabs cannot be used between the following tokens (the smallest meaningful
unit for compiling), in which case they are referred to as token separators.
Tokens: Reserved words, variable names, special characters, constants (numerical values)
Reserved words (upper or lower case):AND, CASE, DO, ELSE, FOR, IT, NOT, OF, OR, REPEAT,
Variable names:
Special characters:
Constants (numerical values):
If a space, carriage return, or tab is used between any of the above tokens, the parts of the token on either
side will be treated as separate tokens. Therefore, make sure that spaces, carriage returns, or tabs are not
used within a single token.
• 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 separa-
tor is required.
IF@A>0THEN@X=10;
ELSE@
X:=0;
END_IF;
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.
Inputting Constants (Numerical Values)
• Numerical values can be expressed in decimal, hexadecimal, octal, or binary, as shown in the following
examples.
Decimal:
Hexadecimal:
Octal:
Binary:
140
THEN, TO, UNTIL, WHILE, XOR, TRUE, FALSE, ELSIF, BY,
EXIT, RETURN
Any text that is not a reserved word will be recognized as a variable
name.
<=, >=, <>, :=, .., &, (*, *)
Numerical value only for decimal numbers
16# followed by numerical value for hexadecimal numbers
2# followed by numerical value for binary numbers
8# followed by numerical value for octal numbers
Notation method
Numerical value only
16# followed by numerical value
8# followed by numerical value
2# followed by numerical value
Example (for the decimal value 12)
12
16#C
8#14
2#1100
Appendix B

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-programmer 5.0Sysmac ws02-cxpc1-e-v50Cs1-hCj1-hCj1m

Table of Contents