Positron Compiler Documentation

BranchL

Positron8 · Revision 4.0.6.5 · PDF page 297

BranchL Index, [Label1 {,...Labeln }]

Cause the program to jump to different locations based on a variable index. On a PICmicro™ device with more than one page of memory.

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.

  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].

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

View original PDF page 297Open page in PDFOriginal PDF page 297