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.

<strong>ISPSoft</strong> <strong>User</strong> <strong>Manual</strong><br />

• Description<br />

A RETRUN statement is used in a function block in a structured text. It ends the program in the<br />

function block.<br />

• Example<br />

The programming language used to create the program in the function block FB0 is a structured<br />

text. After the upper part of the program is executed, the state of X0.0 will be judged. If X0.0 is ON,<br />

the execution will leave the current program. If X0.0 is OFF, the whole program in the function<br />

block will be executed.<br />

11.2.11 EXIT Statement<br />

• Format<br />

• Description<br />

An EXIT statement is used in a REPEAT loop, a WHILE loop, or a FOR loop. It is used to exit the<br />

loop.<br />

• Example<br />

Example 1: The loop below is a REPEAT loop. The loop will not be terminated until the value of<br />

DT is 0. The IF structure in the loop is used with an EXIT statement. The initial value<br />

in D0 is 0. It increases by 1. The loop will not be terminated until the value in D0 is<br />

100. As a result, the loop body will be executed 100 times at most. In the example<br />

below, the initial value of DT is 110. After the loop body is executed for the 100 th time,<br />

the value of DT will become 10. In other words, the final value of DT will be 10. The<br />

value of DT will not decrease to 0.<br />

Example 2: The loop below is a FOR loop. The value of the arithmetic expression D0* D10 is<br />

calculated, and the result of the operation is stored in D0. The IF structure in the loop<br />

is used with an EXIT statement. The loop will not be terminated until the value in D0 is<br />

11-20

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

Saved successfully!

Ooh no, something went wrong!