2 Instruction Descriptions
2-152
NJ-series Instructions Reference Manual (W502)
ADD (+)
The ADD (+) instruction adds integers or real numbers. It also joins text strings.
* 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 ADD (+) instruction adds between two and five integers or real numbers. The data types of add val-
ues In1 to InN and addition result Out can have different data types.
The following example is for when In1 is INT#10, In2 is INT#20 and In3 is INT#30. The value of variable
abc will be INT#60.
Instruction Name FB/FUN Graphic expression ST expression
ADD (+) Addition FUN Out:=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 OK
Out OKOKOKOKOKOKOKOKOKOK OK
Function
(@)ADD
EN ENO
In1 Out
:
InN
:
(@)+
EN ENO
In1 Out
:
InN
:
abc:=INT#10+INT#20+INT#30;
LD ST
abc
INT#10
INT#20
INT#30
ADD
EN ENO
In1
In2
In3