117
C-Control Pro Mega Series
© 2008 Conrad Electronic
5.3.6.2
Do While
With a while instruction the instructions can depending on a condition be repeated in a loop:
Do While Expression
Instructions
End While
At first the Expression is evaluated. If the result is unequal
0
then the expression is executed. After
that the Expression is again calculated and the entire procedure will constantly be repeated until the
Expression takes on the value
0
.
Examples:
Do While a<
10
a=a+
2
End While
Do While a
a=a*
2
x=a
End While
Exit Instruction
If an Exit instruction is executed within a loop than the loop will be left and the program execution
starts with the next instruction after the While loop.
Example:
Do While
1
' Endless loop
a=a+
1
If a>
10
Then
Exit
' Will terminate loop
End If
End While
5.3.6.3
For Next
A For Next loop is normally used to program a definite number of loop runs.
For Counter Variable=Startvalue To Endvalue Step Stepwidth
Instructions
Next
The Counter Variable is set to a Start Value. Then the instructions are repeated until the End Value
is reached. With each loop run the value of the Counter Variable is increased by one step width
which may also be negative. The stating of the step width after the End Value is optional. If no Step
Width is stated it has the value 1.
Summary of Contents for C-Control Pro Mega Series
Page 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Page 9: ...VIII Inhalt 2008 Conrad Electronic ...
Page 10: ...Part 1 ...
Page 17: ...Part 2 ...
Page 23: ...Part 3 ...
Page 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Page 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Page 58: ...Part 4 ...
Page 91: ...82 IDE 2008 Conrad Electronic ...
Page 92: ...Part 5 ...
Page 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Page 136: ...Part 6 ...
Page 231: ...Part 7 ...
Page 240: ......