Subtract - GE PACSystems RX7i Cpu Programmer's Reference Manual

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 4. Ladder Diagram (LD) Programming
4.10.8

Subtract

When the SUB function receives power flow, it subtracts the operand
IN2 from the operand IN1 of the same data type as IN2 and stores the
result in the output variable assigned to Q, also of the same data type.
The power flow output is energized when SUB is performed, unless an invalid operation or Overflow
occurs. (For more information, refer to the section on Overflow.)
If a SUB_UINT operation results in a negative number, Q wraps around, yielding a result that is the
highest possible value (65535) minus the absolute value of the difference -1.
The following REAL and LREAL operations are invalid for SUB:
(± ∞) – (± ∞)
I1 and/or I2 is NaN (Not a Number)
Mnemonic
Operation
SUB_INT
Q(16-bit) = IN1(16-bit) – IN2(16-
bit)
SUB_DINT
Q(32-bit) = IN1(32-bit) – IN2(32-
bit)
SUB_REAL
Q(32-bit) = IN1(32-bit) – IN2(32-
bit)
SUB_LREAL
Q(64-bit) = IN1(64-bit) – IN2(64-
bit)
SUB_UINT
Q(16-bit) = IN1(16-bit) – IN2(16-
bit)
Operands for Subtract
Parameter Description
IN1
The value to subtract from; the value to the left of the minus
sign (-) in the equation IN1-IN2=Q.
IN2
The value to subtract from IN1; the value to the right of the
minus sign (-) in the equation IN1-IN2=Q.
Q
The result of IN1-IN2. If a SUB operation on signed operands
results in underflow, Q is set to the smallest possible value
and there is no power flow.
If a SUB_UINT operation results in
For example,
The SUB_UINT operation 600 – 601 = –1 sets Q to 65535
The SUB_UINT operation 600 – 602 = –2 sets Q to 65534
200
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
Displays as
base 10 number with sign, up to 5 digits long
base 10 number with sign, up to 10 digits long
base 10 number, sign and decimals, up to 8 digits long
(excluding the decimals)
base 10 number, sign and decimals, up to 17 digits long
(excluding the decimals)
base 10 number, unsigned, up to 5 digits long
Overflow
, Q wraps around.
Mnemonics:
SUB_DINT
SUB_INT
SUB_REAL
SUB_LREAL
SUB_UINT
Allowed Operands
Optional
All except S, SA, SB, SC No
All except S, SA, SB, SC No
All except S, SA, SB, SC
No
and constant
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents