2 Instruction Descriptions
2-154
NJ-series Instructions Reference Manual (W502)
AddOU (+OU)
The AddOU (+OU) instruction adds integers and real numbers. It also performs an overflow/underflow
check.
* If you omit the input parameter that connects to InN, the default value is not applied, and a building error will occur. For
example, if N is 3 and the input parameters that connect to In1 and In2 are omitted, the default values are applied, but if the
input parameter that connects to In3 is omitted, a building error will occur.
The AddOU (+OU) instruction adds between two and five integers or real numbers and outputs the
result. The data types of add values In1 to InN and addition result Out can have different data types. If
the addition result exceeds the valid range of the data type that includes all of the data types of In1 to
InN, the value of the P_CY system-defined variable (Carry Flag) changes to TRUE. This indicates that
an overflow or an underflow has occurred.
If Out is a real number and an overflow or underflow occurs, the value of Out is positive or negative
infinity. If Out is an integer, only the bits of the addition result that fit in the data type of Out are assigned
to Out.
The following example is for when In1 is INT#32767, In2 is INT#1 and variable abc has an INT data
type. The addition result (32768) exceeds the valid range of INT data, so the value of P_CY changes to
TRUE. The value of variable abc will be INT#−32768 (the lower 16 bits of 32768).
Instruction Name FB/FUN Graphic expression ST expression
AddOU (+OU) Addition with Over-
flow/Underflow
Check
FUN Out:=AddOU(In1, ···, InN);
Variables
Name Meaning I/O Description Valid range Unit Default
In1 to InN Add values Input Numbers to add, N = 2 to 5 Depends on data type.
---
0*
Out Addition
result
Output Addition result Depends on data type. --- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In1 to InN OKOKOKOKOKOKOKOKOKOK
Out OKOKOKOKOKOKOKOKOKOK
Function
(@)AddOU
EN ENO
In1 Out
:
InN
:
(@)+OU
EN ENO
In1 Out
:
InN
: