Subtract (Sub); Relay Ladder; Structured Text; Function Block - 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

Subtract (SUB)

dest := sourceA - sourceB;
Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS)
The SUB instruction subtracts Source B from Source A and places the result in
the Destination.
Operands:

Relay Ladder

Operand
Source A
Source B
Destination

Structured Text

Use the minus sign "−" as an operator in an expression. This expression subtracts
sourceB from sourceA and stores the result in dest.
See
Structured Text Programming
within structured text.

Function Block

Operand
SUB tag
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Type
Format
SINT
Immediate Tag
INT
DINT
REAL
A SINT or INT tag converts to a DINT value by sign-extension.
SINT
Immediate Tag
INT
DINT
REAL
A SINT or INT tag converts to a DINT value by sign-extension.
SINT
Tag
INT
DINT
REAL
for information on the syntax of expressions
Type
FBD_MATH
Description
Value from which to subtract Source B
Value to subtract from Source A
Tag to store the result
Format
Description
structure
SUB structure
Chapter 6
269

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents