Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 263
Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS) Chapter 6
Description: The CPT instruction performs the arithmetic operations you define in the
expression. When enabled, the CPT instruction evaluates the expression and
places the result in the Destination.
The execution of a CPT instruction is slightly slower and uses more memory than
the execution of the other compute/math instructions. The advantage of the
CPT instruction is that it allows you to enter complex expressions in one
instruction.
Arithmetic Status Flags: Arithmetic status flags are affected.
Fault Conditions: None
Execution:
Example 1: When enabled, the CPT instruction evaluates value_1 multiplied by 5 and
divides that result by the result of value_2 divided by 7 and places the final result
in result_1.
Example 2: When enabled, the CPT instruction truncates float_value_1 and float_value_2,
raises the truncated float_value_2 to the power of two and divides the truncated
float_value_1 by that result, and stores the remainder after the division in
float_value_result_cpt.
There is no limit to the length of an expression.
Condition Relay Ladder Action
Prescan The rung-condition-out is set to false.
Rung-condition-in is false The rung-condition-out is set to false.
Rung-condition-in is true The instruction evaluates the Expression and places the result in the Destination.
The rung-condition-out is set to true.
Postscan The rung-condition-out is set to false.