Trinamic 11-0011 TMCM-171 BLDC Output For 3-phase BLDC Motors 11-0011 Data Sheet

Product codes
11-0011
Page of 134
 
TMCL Reference Manual 
31 
 
 
 
Trinamic Motion Control GmbH & Co KG 
Sternstraße 67 
D – 20357 Hamburg, Germany 
http://www.trinamic.com 
 
3.17  COMP – Compare 
Description:  The  specified  number  is  compared  to  the  value  in  the  accumulator  register.  The  result  of  the 
comparison can for example be used by the conditional jump (JC) instruction. This command is intend for use in 
stand-alone operation only and must not be used indirect 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/GIO/CALC/CALCX). The internal arithmetic status flags are set 
according to the comparison result. 
 
Related commands: JC (jump conditional), GAP, GGP,GIO, CALC, CALCX 
 
Binary representation: 
INSTRUCTION NO. 
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 motor #2 is greater than or equal to 1000. 
 
GAP 1, 2, 0             
//get axis parameter, type: no. 1 (actual position), motor: 2, 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 
Function 
Target- 
address 
Instruction 
Number 
Type 
Motor/ 
Bank 
Operand 
Byte3 
Operand 
Byte2 
Operand 
Byte1 
Operand 
Byte0 
Checksum 
Value (hex) 
$01 
$14 
$00 
$00 
$00 
$00 
$03 
$e8 
$00 
 
 
Note that the host address and the reply is only used to transfer this instruction to the TMCL program  memory 
during downloading of a TMCL program. It does not make sense to use this command in direct mode.