![background image](http://html1.mh-extra.com/html/omron/cs1-h-series/cs1-h-series_operation-manual_742526155.webp)
140
Structured Text (ST Language) Specifications
Appendix B
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,
THEN, TO, UNTIL, WHILE, XOR, TRUE, FALSE, ELSIF, BY,
EXIT, RETURN
Variable names:
Any text that is not a reserved word will be recognized as a variable
name.
Special characters:
<=, >=, <>, :=, .., &, (*, *)
Constants (numerical values):
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
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.
Notation method
Example (for the decimal value 12)
Decimal:
Numerical value only
12
Hexadecimal:
16# followed by numerical value
16#C
Octal:
8# followed by numerical value
8#14
Binary:
2# followed by numerical value
2#1100
Содержание CS1-H Series
Страница 3: ...iv...
Страница 5: ...vi...
Страница 7: ...viii TABLE OF CONTENTS...
Страница 15: ...xvi Application Precautions 4...
Страница 151: ...136 Procedures Section 3 2...
Страница 153: ...138 Data Types Appendix A...
Страница 177: ...162 External Variables Appendix C...
Страница 181: ...166 Revision History...