User manual

TMCM-1180 and PD86-1180 TMCL Firmware V4.42 Manual (Rev. 1.08 / 2012-NOV-20) 59
www.trinamic.com
5.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 <operation>, <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