Download SYSMAC CX-Programmer Ver. 9._ OPERATION MANUAL
Transcript
Section 5-3 Inputting ST Programs 5-2-2 Derivative Data Types Data type Array Structure 5-3 5-3-1 Content 1-dimensional array; 32,000 elements max. User-defined data type Inputting ST Programs Syntax Rules Statement Delimiters • Statements (assignment and control statements) must always end in a semicolon (;). The statement cannot be completed by simply using a carriage return. • Do not use a semicolon (;) as a delimiter within a statement such as following reserved words, values, or equations. Inserting a semicolon within a statement, except at the end of a statement, will result in a syntax error. Comments • Comments are enclosed in parentheses and asterisks, i.e., (*comment*). Any characters except parentheses and asterisks can be used within a comment. Nesting within comments is not supported. Notation Example (*comment*) (*this is the comment*) Note Spaces, Carriage Returns, Tabs Nesting in comments is not possible, i.e., (*(*this type of nesting is not supported*)*) • 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 140