2 Standard Functions
2 - 56
NX-series Safety Control Unit Instructions Reference Manual (Z931)
ADD
This function adds integers or durations.
If you omit an input or output parameter, a building error will occur.
An error will not occur if the output terminal is not used or if it is connected to an input terminal on the
next instruction.
This function adds integers or durations, and outputs the result to output value Out.
An overflow occurs if the sum of In1 to InN exceeds the valid range of the data type of the addition
result. If an overflow occurs, the data types of In1 to InN, the data type of the addition result, and the
value of the addition result will be as shown in the following table.
Instruction Name FB/FUN Graphic expression
ADD Addition FUN
Variables
Name I/O Description Valid range Default
In1 to InN Values to add Input Values to add Depends on data type. ---
Out Output value Output Output value Depends on data type. ---
Boolean Bit strings Integers Durations
BOOL
SAFEBOOL
BYTE
SAFEBYTE
WORD
SAFEWORD
DWORD
SAFEDWORD
INT
SAFEINT
DINT
SAFEDINT
TIME
SAFETIME
In1 to InN OK OK OK OK OK OK
Out OK OK OK OK OK OK
Function
I/O data types Value of addition results
Integers Of the sum of In1 to InN, the addition result will be the value that can be expressed by the
number of bits in the data type of the addition result.
*1*2
*1. For example, if the value of In1 is INT#32767 and the value of In2 is INT#3, the addition result will be 32770.
If an INT variable is set for the output, the value of the addition result will be the value that can be expressed
with lower 16 bits of the sum (32,770), i.e., −32,766. If a DINT variable is set for the output, the addition result
is DINT#32770.
*2. If the result exceeds the valid range of DINT data, the result will be the value that can be expressed with the
lower 32 bits.
Durations Of the sum of In1 to InN, the addition result will be the value that can be expressed with
DWORD data.
*3
*3. For example, if the value of In1 is TIME#49d17h2m47s295ms and the value of In2 is TIME#5ms, the value of
the addition result is TIME#49d17h2m47s30ms. However, the maximum value of TIME is the same as for
DWORD (4294967295), so the addition result will be the value that can be expressed with 32 bits, i.e.,
TIME#4ms.
ADD