User Manual
PD42-1240 TMCL
™
Firmware Manual • Firmware Version V1.45 | Document Revision V1.02 • 2018-DEC-03
79 / 132
3.6.39 CALCV (Calculate using a User Variable and a Direct Value)
The CALCV directly modifies a user variable using an arithmetical operation and a direct value. This
eliminates the need of using the accumulator register for such a purpose and thus can make the program
shorter and faster. The parameters of this command are the arithmetic function, the index of a user
variable (0. . . 255) and a direct value. This command is mainly intended for use in standalone mode.
Related commands: CALCVA, CALCAV, CALCVX, CALCXV, CALCVV.
Mnemonic: CALCV <operation>, <var>, <value>
Binary representation
Binary Representation
Instruction Type Motor/Bank Value
45 0 ADD – add <value> to <var> 0 <var> (0. . . 255) <value>
1 SUB – subtract <value> from <var>
2 MUL – multiply <var> with <value>
3 DIV – divide <var> by <value>
4 MOD – modulo divide <var> by <value>
5 AND – logical and <var> with <value>
6 OR – logical or <var> with <value>
7 XOR – logical exor <var> with <value>
8 NOT – logical invert <var> (<value> ignored)
9 LOAD – copy <value> to <var>
11 COMP – compare <var> with <value>
Reply in Direct Mode
Status Value
100 - OK the operand (don’t care)
Example
Subtract 5000 from user variable #27.
Mnemonic: CALCV SUB, 27, 5000
©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