MNEMONIC

FUNCTION

TYPE

BR

Branch

Program Instruction

DESCRIPTION

The branch instruction can be used to perform a conditional or unconditional branch to a routine in an MDrive program. It can also be used to perform loops and IF THEN logic within a program.

There are two parameters to a branch instruction. These are used to perform two types of branches:

Conditional Branch

This type of branch first specifies an address or process label where program execution should continue if the second parameter, the condition, is true. The condition parameter may include flags as well as logical functions that are to be evaluated.

Unconditional Branch

In this type of branch the second parameter is not specified, then the execution will continue at the address specified by the first parameter.

USAGE

BR <addr/label, cond>

EXAMPLE:

 

BR 256, I2

‘Branch to program line 256 if Input 2 is TRUE

BR 120

‘Unconditional Branch to program line 120

BR JC, I1=1 ‘Branch to process labeled JC if input 1 is True

RELATED COMMANDS: —

MNEMONIC

FUNCTION

 

TYPE

BY

Busy Flag (Read Only)

Motion Flag

DESCRIPTION

 

 

 

This read only status flag will indicate whether or not the axis is moving.

 

 

 

 

 

USAGE

UNITS

RANGE

DEFAULT

PR BY

0/1

0

 

 

 

 

EXAMPLE:

 

 

 

PR BY

‘read the state of the busy flag

 

 

 

 

 

RELATED COMMANDS: PR

 

 

 

 

 

 

MNEMONIC

FUNCTION

 

TYPE

C1

Set Counter 1 (Motor Counts)

Motion Variable

DESCRIPTION

This variable contains the raw count representation of the clock pulses sent to the motor drive.

USAGE

UNITS

RANGE

DEFAULT

C1=<counts>

Motor Counts

-2147483648 to 2147483647

0

 

 

 

 

EXAMPLE:

 

 

 

C1=20000

‘Set Counter 1 to 20000 motor counts

 

PR C1

‘Print the value of C1 to the terminal screen

 

RELATED COMMANDS: C2, P

39

Page 41
Image 41
Intelligent Motion Systems 17 manual Branch Program Instruction, Busy Flag Read Only Motion Flag