User Manual

PD42-1240 TMCL
Firmware Manual Firmware Version V1.45 | Document Revision V1.02 2018-DEC-03
69 / 132
3.6.34 CALCVV (Calculate using two User Variables)
The CALCVV instruction directly uses the contents of two user variables for an arithmetic operation, storing
the result in the rst user variable. This eliminates the need for using the accumulator register and/or X
register for such purposes. The parameters of this command are the arithmetic function, the index of the
rst user variable (0. . . 255) and the index of the second user variable (0. . . 255). This command is mainly
intended for use in standalone mode.
Related commands: CALCVA, CALCAV, CALCVX, CALCXV, CALCV.
Mnemonic: CALCVV <operation>, <var1>, <var2>
Binary representation
Binary Representation
Instruction Type Motor/Bank Value
40 0 ADD add <var2> to <var1> 0 <var1> (0. . . 255) <var2> (0. . . 255)
1 SUB subtract <var2> from <var1>
2 MUL multiply <var2> with <var1>
3 DIV divide <var2> by <var1>
4 MOD modulo divide <var2> by <var1>
5 AND logical and <var2> with <var1>
6 OR logical or <var2> with <var1>
7 XOR logical exor <var2> with <var1>
8 NOT copy logical inverted <var2> to <var1>
9 LOAD copy <var2> to <var1>
10 SWAP swap contents of <var1> and <var2>
11 COMP compare <var1> with <var2>
Reply in Direct Mode
Status Value
100 - OK the operand (dont care)
Example
Subtract user variable #42 from user variable #65.
Mnemonic: CALCVV SUB, 65, 42
©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com