02.09.2014 Views

ISPSoft User Manual

ISPSoft User Manual

ISPSoft User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11 Structured Text<br />

A complete statement corresponds to a network in a ladder diagram. It represents a task. Take the<br />

sub-statement shown above for example. The value of the arithmetic expression D0* (D1+D2) is<br />

calculated, and the result of the operation is stored in D10. The arithmetic expression in the red<br />

frame in the figure below is not a legal statement. It is an expression. It is not a concrete task. It is<br />

like the ladder diagram shown below. The ladder diagram lacks an output operand. It is not a<br />

complete program which can be executed.<br />

A structured text is composed of statements, and a statement is composed of elements. An example<br />

of a structured text is shown below. The complete statements in the structured text are in the red<br />

frames.<br />

* In a structured text, “:=” means “to assign”, and “=” means “to be equal to”.<br />

11.1.3 Expression<br />

An expression is an important element of a statement. It represents a value. An expression can be<br />

an arithmetic expression, a constant, a symbol, or a device. Examples are listed below.<br />

• M0 & M1 (Boolean value)<br />

The logical operator & takes M0 and M1, and performs the logical & operation on M0 and M1.<br />

The result of the operation is a Boolean value.<br />

• M0 = FALSE (Boolean value)<br />

The expression is a conditional expression. If M0 is ON, the Boolean value is TRUE. If M0 is OFF,<br />

the Boolean value is TRUE.<br />

• M0 (Boolean value)<br />

If M0 is ON, the Boolean value is TRUE. If M0 is OFF, the Boolean value is FALSE.<br />

• D1 + D2 (Value)<br />

The value of the arithmetic expression D1+D2 is calculated.<br />

• D0 (Value)<br />

The value represented by the expression if the value stored in D0.<br />

• D2 = D0 + D1 (Boolean value)<br />

If the value of the arithmetic expression D0+D1 is equal to the value stored in D2, the Boolean<br />

value is TRUE. If the value of the arithmetic expression D0+D1 is not equal to the value stored in<br />

D2, the Boolean value is FALSE.<br />

11-3

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

Saved successfully!

Ooh no, something went wrong!