Delta ISPSoft — 13.2.4 Loop Structure - REPEAT

ISPSoft User Manual 13.2.4 Loop Structure - REPEAT  Format  Description The sub-statement is executed, and then the Boolean expression is evaluated. If the Boolean expression is evaluated as TRUE, the loop will be terminated. If the value of the Boolean expression is FALSE, the program in the structure will be executed repeatedly until the value of the Boolean expression is TRUE.  Rules and limits  The Boolean expression can be a device, a symbol, or an arithmetic expression. It can not be a constant.  The sub-statement is executed before the Boolean expression is evaluated, and therefore the sub-statement is executed at least once.

 The sub-statement can be a legal statement, or another structure. There is no limit on the number of sub-statements in a REPEAT structure. One loop structure can be embedded in another loop structure. There are at most 64 loop structures.  If the value of the Boolean expression following UNTIL is TRUE, the loop will be terminated. To prevent an infinite loop, the operand in the Boolean expression following UNTIL can not be a device or a symbol which cannot be updated.  The X devices in a program are updated after the program is scanned.

If users want to use an X device as the operand of the Boolean expression, they have to add an I/O update instruction to the structure, or  Example update the X through an interrupt subroutine. Example 1: The initial value of DT1 is 0. In the loop structure, the value of DT1 increases progressively by 2. The loop will not be terminated until the value of DT1 is larger than 100. 13-18