WHILE - Perform Loop While Condition is True

MPASM Assembler

WHILE - Perform Loop While Condition is True

Syntax

while <expr>

:

endw

Description

The lines between the while and the endw are assembled as long as <expr> evaluates to TRUE. An expression that evaluates to zero is considered logically FALSE. An expression that evaluates to any other value is considered logically TRUE. A relational TRUE expression is guaranteed to return a non-zero value; FALSE a value of zero.

A while loop can contain at most 100 lines and be repeated a maximum of 256 times. while loops can be nested up to 8 deep.

Example

test_mac macro count

variable i

i = 0

while i < count

movlw i

i += 1

endw

endm

start

test_mac 5

end

See Also

ENDW IF


Microchip Technology Inc.
Microchip's Web Site
Voice: (480) 792-7200
Fax: (480) 899-9210
Microchip's E-mail Address
PreviousNext