Compute (Cpt); Relay Ladder; Structured Text - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Chapter 6
Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS)
If you want to
Calculate the square root of a value
Take the opposite sign of a value
Take the absolute value of a value
(1) There is no equivalent structured text instruction. Use other structured text programming to achieve the same result. See the description for the instruction.
(2) There is no equivalent structured text instruction. Use the operator in an expression.
(3) Structured text only.

Compute (CPT)

262
Use this instruction
SQR
(3)
SQRT
NEG
ABS
You can mix data types, but loss of accuracy and rounding error might occur and
the instruction takes more time to execute. Check the S:V bit to see whether the
result was truncated.
For relay ladder instructions, bold data types indicate optimal data types. An
instruction executes faster and requires less memory if all the operands of the
instruction use the same optimal data type, typically DINT or REAL.
The CPT instruction performs the arithmetic operations you define in the
expression.
Operands:

Relay Ladder

Operand
Destination
Expression

Structured Text

Structured text does not have a CPT instruction, but you can achieve the same
results by using an assignment and expression.
destination := numeric_expression;
See
Structured Text Programming
and expressions within structured text.
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Available in these languages
Relay ladder
Structured text
Function block
Relay ladder
Structured text
Function block
Relay ladder
Structured text
Function block
Type
Format
SINT
Tag
INT
DINT
REAL
SINT
Immediate Tag
INT
DINT
REAL
A SINT or INT tag converts to a DINT value by sign-extension.
for information on the syntax of assignments
Page
283
286
(2)
289
Description
Tag to store the result
An expression consisting of tags and/or
immediate values separated by operators

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents