02.09.2014 Views

ISPSoft User Manual

ISPSoft User Manual

ISPSoft User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 11 Structured Text<br />

Data format<br />

Example of an<br />

expression<br />

Result of an<br />

Symbol Function<br />

Precedence<br />

operation<br />

Operand<br />

Expression Value<br />

(Value of an<br />

expression)<br />

The<br />

parenthetical<br />

( )<br />

part of an<br />

expression is<br />

Unspecified Unspecified (D0 + 6)* 3 33 Highest<br />

calculated<br />

first.<br />

** Exponentiation Floating-point Floating-point<br />

number number<br />

2.0 ** 5.0 3.2E+1<br />

- Negative sign<br />

Signed Signed<br />

number number<br />

-(D0 + 3) -8<br />

NOT<br />

Logical Boolean<br />

negation value<br />

Boolean value NOT M0 TRUE<br />

* Multiplication Any value Any value D0 * 3 15<br />

/ Division Any value Any value 15 / D0 3<br />

MOD Remainder Integer Integer D0 MOD 3 2<br />

+ , -<br />

Addition,<br />

subtraction<br />

Any value Any value D0 + 3 8<br />

< , >,=<br />

Comparison Any value Boolean value D0 > 2 TRUE<br />

=, <br />

AND, &<br />

XOR<br />

OR<br />

Equal to, not<br />

equal to<br />

Logical AND<br />

operation<br />

Logical<br />

exclusive OR<br />

operation<br />

Logical<br />

inclusive OR<br />

operation<br />

Any value D0 2 TRUE<br />

Boolean value<br />

Boolean<br />

value<br />

M0 = TRUE FALSE<br />

Boolean<br />

value<br />

Boolean value M0 & M1 FALSE<br />

Boolean<br />

value<br />

Boolean<br />

value<br />

Boolean value M0 XOR M1 TRUE<br />

Boolean value M0 OR M1 TRUE Lowest<br />

*1. In the table above, the default value of M0 is FALSE, the default value of M1 is TRUE, and the default value of D0<br />

is 5.<br />

*2. The operands for an exponentiation operator must be constants or floating-point symbols, and must not be<br />

devices.<br />

11.1.5 Keyword and Comment<br />

In computer programming, a keyword is a word which has a special meaning to the programming<br />

language. For example, TRUE and FALSE in a program represent Boolean values, and the IF<br />

statements in the example above represent tasks which will be executed. Besides, applied<br />

instructions are regarded as keywords. In order to prevent a program from being compiled<br />

incorrectly, the words which are regarded as keywords in the program can not be declared to be<br />

symbols. However, the words which are regarded as keywords in a program can be parts of the<br />

symbols in the program. For example, “FIFO” and “_IF” are allowed.<br />

In a structured text, the words between (* and *) are regarded as comments. When a program is<br />

compiled, the system automatically skips the words between (* and *) in the program. Besides, as<br />

long as the structure of a structured text is not destroyed, comments can be put anywhere in the<br />

structured text. However, users have to be careful about the readability of the structured text.<br />

11-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!