IF - Begin Conditionally Assembled Code Block

MPASM Assembler

IF - Begin Conditionally Assembled Code Block

Syntax

if <expr>

Description

Begin execution of a conditional assembly block. If <expr> evaluates to true, the code immediately following the if will assemble. Otherwise, subsequent code is skipped until an else directive or an endif directive is encountered.

An expression that evaluates to zero is considered logically FALSE. An expression that evaluates to any other value is considered logically TRUE. The if and while directives operate on the logical value of an expression. A relational TRUE expression is guaranteed to return a nonzero value, FALSE a value of zero.

if's may be nested up to 16 deep.

Example

if version == 100; check current version

movlw 0x0a

movwf io_1

else

movlw 0x01a

movwf io_2

endif

See Also

ELSE ENDIF


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