BranchL
Syntax
BranchL Index, [Label1 {,...Labeln }]
Overview
Cause the program to jump to different locations based on a variable index. On a PICmicro™ device with more than one page of memory.
Parameters
Index is a constant, variable, or expression, that specifies the address to branch to. Label1,...Labeln are valid labels that specify where to branch to. A maximum of 127 labels may be placed between the square brackets, 256 if using an 18F device.
Example
Device = 16F1829
Dim Index as Byte
Start:
Index = 2 ' Assign Index a value of 2
' Jump to label 2 (Label_2) because Index = 2
BranchL Index,[Label_0, Label_1, Label_2]
Label_0:
Index = 2 ' Index now equals 2
GoTo Start
Label_1:
Index = 0 ' Index now equals 0
GoTo Start
Label_2:
Index = 1 ' Index now equals 1
GoTo Start
The above example we first assign the index variable a value of 2, then we define our labels. Since the first position is considered 0 and the variable index equals 2 the BranchL command will cause the program to jump to the third label in the brackets [Label_2].
Notes
The BranchL command is mainly for use with PICmicro™ devices that have more than one page of memory (greater than 2048). It may also be used on any PICmicro™ device, but does produce code that is larger than Branch.
See also : Branch
