TMCM-1310 TMCL Firmware V1.11 Manual (Rev. 1.16 / 2014-MAR-19)
46
www.trinamic.com
6.8.21
RSUB (return from subroutine)
Return from a subroutine to the command after the CSUB command.
This command is intended for standalone operation only.
Internal function:
the TMCL program counter is set to the last value of the stack. The command will be
ignored if the stack is empty.
Related command:
CSUB
Mnemonic:
RSUB
Binary representation:
INSTRUCTION NO.
TYPE
MOT/BANK
VALUE
24
don’t care
don’t care
don’t care
Example:
Call a subroutine
Loop: MVP ABS, 0, 10000
CSUB SubW
//Save program counter and jump to label SubW
MVP ABS, 0, 0
JA Loop
SubW: WAIT POS, 0, 0
WAIT TICKS, 0, 50
RSUB
//Continue with the command following the CSUB command
Binary format of RSUB:
Byte Index
0
1
2
3
4
5
6
7
Function
Target-
address
Instruction
Number
Type
Motor/
Bank
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Value (hex)
$01
$18
$00
$00
$00
$00
$00
$00