![EtherCAT TMCL Firmware Manual Download Page 53](http://html1.mh-extra.com/html/ethercat/tmcl/tmcl_firmware-manual_2432550053.webp)
TMCM-1310 TMCL Firmware V1.11 Manual (Rev. 1.16 / 2014-MAR-19)
53
www.trinamic.com
6.8.28
CALCX (calculate using the X register)
This instruction is very similar to CALC, but the second operand comes from the X register. The X register
can be loaded with the LOAD or the SWAP type of this instruction. The result is written back to the
accumulator for further processing like comparisons or data transfer.
Related commands:
CALC, COMP, JC, AAP, AGP
Mnemonic:
CALCX <operation>
Binary representation:
INSTRUCTION NO.
TYPE <operation>
MOT/BANK
VALUE
33
0 ADD
add X register to accu
1 SUB
subtract X register from accu
2 MUL
multiply accu by X register
3 DIV
divide accu by X-register
4 MOD
modulo divide accu by x-register
5 AND
logical and accu with X-register
6 OR
logical or accu with X-register
7 XOR
logical exor accu with X-register
8 NOT
logical invert X-register
9 LOAD load accu to X-register
10 SWAP swap accu with X-register
don’t care
don’t care
Example:
Multiply accu by X-register
Mnemonic:
CALCX MUL
Binary:
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
$21
$02
$00
$00
$00
$00
$00