User Manual
MCP Series 
Brushed DC Motor Controllers
MCP Series User Manual
154
BRANCH
Syntax
branch index, [label1, label2, label3, ..., labelN] 
• Index - is a variable, constant or expression that is used to reference a label in a list. The index 
is    0 based.
• Label - is a list of constant labels that are jump points in a program.
Description
The BRANCH command will jump to a label dened within the brackets. The label used for the 
jump is determined by the pointer index. The only limits to the number of labels within the 
brackets is the available program memory. 
Example
Connect to the following program with the terminal window at 9600 baud. Enter a value from 0 
to 4. The program will jump to the label specied by the value typed in. The BRANCH command 
is a great way to build a long conditional jump list based on some value range. User interactive 
menu systems are one possibility.
Index var word
Main
  Pause 1000
  for Index = 0 to 4
 gosub jumptable
 next
  Goto Main
jumptable
  branch Index, [label0, label1, label2, label3, label4] 
Label0
  puts 0, [13, “Label 0”]
 return
Label1
  puts 0, [13, “Label 1”]
 return
Label2
  puts 0, [13, “Label 2”]
 return
Label3
  puts 0, [13, “Label 3”]
 return
Label4
  puts 0, [13, “Label 4”]
 returnCLEAR










