- IMS MDrive17 Motion Control Operating Instructions

40
MNEMONIC FUNCTION TYPE
CL Call Subroutine Program Instruction
DESCRIPTION
This function can be used to invoke a subroutine within a program. This allows the user to segment code and call a subroutine from
a number of places rather than repeating code within a program.
There are two parameters to the CL instruction. The first specifies the program address or label of the subroutine to be invoked if
the second parameter, the condition, is true. If the second parameter is not specified, the subroutine specified by the first parameter
is always invoked. The condition parameter can include flags as well as logical functions that are to be evaluated.
The subroutine should end with a RT (RET) instruction. The RT instruction will cause program execution to return to the line
following the CL instruction.
USAGE
CL <addr/label, cond>
EXAMPLE:
CL 256, I1=1 ‘Call subroutine at program line 256 if Input 1 is TRUE
CL JK ‘Call subroutine labeled JK
RELATED COMMANDS: RT
MNEMONIC FUNCTION TYPE
CP Clear Program Program Instruction
DESCRIPTION
This instruction will clear the program space in the EEPROM as specified by the instruction parameter. Programs are stored directly
to the EEPROM and executed from there.
USAGE
CP <addr/label>
EXAMPLE:
CP 256 ‘Clear program space beginning at line 256 to the end of program space
CP ‘Clear all of program space
RELATED COMMANDS: —
MNEMONIC FUNCTION TYPE
C2 Set Counter 2 (Encoder Counts) Motion Variable
DESCRIPTION
This variable contains the raw count representation of the integral 512 line encoder.
USAGE UNITS RANGE DEFAULT
C2=<counts> Encoder Counts -2147483648 to 2147483647 0
EXAMPLE:
C2=512 ‘Set Counter 2 to 512 encoder counts
PR C2 ‘Print the value of C2 to the terminal screen
RELATED COMMANDS: C1, EE, P