Divide - 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.4

Divide

When the DIV function receives power flow, it divides the operand IN1 by the
operand IN2 of the same data type as IN1 and stores the quotient in the
output variable assigned to Q, also of the same data type as IN1 and IN2.
The power flow output is energized when DIV is performed, unless an invalid
operation or Overflow occurs. (For more information, refer to the section on
Overflow.)
Notes:
DIV rounds down; it does not round to the closest integer. For example,
24 DIV 5 = 4.
DIV_MIXED uses mixed data types.
Be careful to avoid overflows.
The following REAL and LREAL operations are invalid for DIV:
Any number divided by 0. This operation yields a result of 65535.
∞ divided by ∞
I1 and/or I2 is NaN (Not a Number)
Mnemonic
Operation
DIV_UINT
Q(16-bit) = IN1(16-bit) / IN2(16-bit)
DIV_INT
Q(16-bit) = IN1(16-bit) / IN2(16-bit)
DIV_DINT
Q(32-bit) = IN1(32-bit) / IN2(32-bit)
DIV_MIXED
Q(16-bit) = IN1(32-bit) / IN2(16-bit)
DIV_REAL
Q(32-bit) = IN1(32-bit) / IN2(32-bit)
DIV_LREAL
Q(64-bit) = IN1(64-bit) / IN2(64-bit)
Operands for the DIV Function
Parameter Description
IN1
Dividend: the value to be divided; shown to the left of DIV in
the equation IN1 DIV IN2=Q.
IN2
Divisor: the value to divide into IN1; shown to the right of DIV
in the equation IN1 DIV IN2=Q.
Q
The quotient of IN1/IN2. If a DIV operation on signed operands
Overflow
results in
there is no power flow.
If a DIV_UINT operation results in
194
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
Displays as
base 10 number, unsigned, up to 5 digits long
base 10 number with sign, up to 5 digits long
base 10 number with sign, up to 10 digits long
base 10 number with sign, up to 5 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)
, Q is set to the largest possible value and
Overflow
, Q wraps around.
Mnemonics:
DIV_DINT
DIV_INT
DIV_MIXED
DIV_REAL
DIV_LREAL
DIV_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