User manual
TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 29
www.trinamic.com
4.6.15 COMP (compare)
The specified number is compared to the value in the accumulator register. The result of the comparison can
be used for example by the conditional jump (JC) instruction. This command is intended for use in
standalone operation, only. The host address and the reply are required to take the instruction to the TMCL
program memory while the TMCL program downloads. It does not make sense to use this command in
direct mode.
Internal function: The specified value is compared to the internal accumulator, which holds the value of a
preceding get or calculate instruction (see GAP/GGP/CALC/CALCX). The internal arithmetic status flags are set
according to the comparison result.
Related commands: JC (jump conditional), GAP, GGP, CALC, CALCX
Mnemonic: COMP <value>
Binary representation:
COMMAND
TYPE
MOT/BANK
VALUE
20
don’t care
don’t care
<comparison value>
Example:
Jump to the address given by the label when the position of the motor #0 is greater or equal to
1000.
GAP 1, 0, 0 //get axis parameter, type: no. 1 (actual position), motor: 0, value: 0 don’t care
COMP 1000 //compare actual value to 1000
JC GE, Label //jump, type: 5 greater/equal, the label must be defined somewhere else in the
program
Binary format of the COMP 1000 command:
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
$14
$00
$00
$00
$00
$03
$e8