C Control The I Unit-M Advanced 5 Vdc Inputs / outputs 16 x digital I/Os / 8 x analogue or digital I/Os Program memory 2 198805 Datenbogen
Produktcode
198805
To create a simple program loop, you should use DO LOOP UNTIL. The loop is executed at least one time
and may be quit early with Exit Do. The Until instruction at the end of the loop checks the expression to be
True or False. True will cause to exit the loop.
The Exit Do can only be used within a Do...Loop control structure to provide an alternate way to exit a
Do...Loop. Any number of Exit Do statements may be placed anywhere in the Do...Loop. Often used with the
evaluation of some condition (for example, If...Then), Exit Do transfers control to the statement immediately
following the Loop.
When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one nested level
above the loop where it occurs.
Syntax: Do
and may be quit early with Exit Do. The Until instruction at the end of the loop checks the expression to be
True or False. True will cause to exit the loop.
The Exit Do can only be used within a Do...Loop control structure to provide an alternate way to exit a
Do...Loop. Any number of Exit Do statements may be placed anywhere in the Do...Loop. Often used with the
evaluation of some condition (for example, If...Then), Exit Do transfers control to the statement immediately
following the Loop.
When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one nested level
above the loop where it occurs.
Syntax: Do
[instruction]
[Exit Do]
[Exit Do]
Loop (Until [expression])
DO
Mybyte=Mybyte+1
IF MyPort=OFF THEN EXIT DO
LOOP UNTIL MyByte=5
IF, THEN, ELSE END IF
Conditionally executes a group of statements, depending on the value of an expression.
You can use the single-line form (first syntax) for short, simple tests. However, the block form (second
syntax) provides morestructure and flexibility than the single-line form and is usually easier to read, maintain,
and debug. A block IF statement must be the first statement on a line. The block IF must end with an END IF
statement.
Syntax1: If [expression] Then [instruction] [Else] [instruction]
IF MyByte=10 THEN GOTO X ELSE GOTO Y
Syntax2: If [expression] Then
[instructions]
[Else]
[elseinstructions]
End If
IF MyWord=10 THEN
PRINT "This is "
PRINT MyWord
ELSE
PRINT "No Match"
PRINT "found"
END IF
SELECT CASE, CASE, CASE ELSE
Executes one of several groups of statements, depending on the value of an expression.
If matchexpression matches any Case expression, the statements following that CASE clause are executed
up to the next CASE clause, or for the last clause, up to END SELECT. Control then passes to the statement
following END SELECT If matchexpression matches an expression in more than one CASE clause, only the
statements following the first match are executed.
The CASE ELSE clause is used to indicate the elseinstructions to be executed if no match is found between
the matchexpression and an Case expression in any of the other Case selections. Although not required, it is
a good idea to have a CASE ELSE statement in your SELECT CASE block to handle unforeseen
matchexpression values. If no Case expression matches matchexpression and there is no CASE ELSE
statement, execution continues at the statement following END SELECT
20