TMCM-142 TMCL
TM
Firmware Manual (V1.06 / 2014-JUN-24)
66
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
6.7.16
CALC (calculate)
A value in the accumulator variable, previously read by a function such as GAP (get axis parameter), can be
modified with this instruction. Nine different arithmetic functions can be chosen and one constant operand
value must be specified. The result is written back to the accumulator, for further processing like
comparisons or data transfer.
Related commands:
CALCX, COMP, JC, AAP, AGP, GAP, GGP, GIO
Mnemonic:
CALC <op>, <value>
where <op> is ADD, SUB, MUL, DIV, MOD, AND, OR, XOR, NOT or LOAD
Binary representation:
INSTRUCTION NO.
TYPE
MOT/BANK
VALUE
19
0 ADD – add to accu
1 SUB – subtract from accu
2 MUL – multiply accu by
3 DIV – divide accu by
4 MOD – modulo divide by
5 AND – logical and accu with
6 OR – logical or accu with
7 XOR – logical exor accu with
8 NOT – logical invert accu
9 LOAD – load operand to accu
(don't care)
<operand>
Example:
Multiply accu by –5000
Mnemonic:
CALC MUL, -5000
Binary:
Byte Index
0
1
2
3
4
5
6
7
8
Function
Target-
address
Instruction
Number
Type
Motor/
Bank
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Checksum
Value (hex)
$01
$13
$02
$00
$FF
$FF
$EC
$78
$78