Datasheet
Programming PIC Microcontrollers in BASIC - mikroElektronika
Example
I = 0
do
 I = I + 1 ' execute these 2 statements
 PORTB = I ' until i equals 10 (ten)
loop until I = 10
4.2.3 WHILE Statement – Loop while condition is fulfilled
Syntax
while expression
 statement_0
 statement_1
 ...
 statement_N
wend
Description Expression is tested first. If it returns True, all the following statements enclosed 
by while and wend will be executed (or only one statement, alternatively). It 
will keep on executing statements until the expression returns False.
Eventually, as expression returns False, while will be terminated without 
executing statements.
While is similar to do..loop, except the check is performed at the beginning 
of the loop. If expression returns False upon first test, statements will not be 
executed.
Example
while I < 90
 I = I + 1
wend
 ...
while I > 0
 I = I div 3
 PORTA = I
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/04.htm (8 sur 9)05/11/2004 02:15:36










