1906
27 ARITHMETIC OPERATION FUNCTIONS
27.1 Addition
27 ARITHMETIC OPERATION FUNCTIONS
27.1 Addition
ADD(_E)
These functions output the sum of input values ((s1)+(s2)++(s28)).
*1 The input variable s can be changed within the range from 2 to 28.
■Description, type, data type
■Operation processing
• These functions add the INT, DINT, REAL, or LREAL data type values input to (s1) to (s28) ((s1)+(s2)++(s28)), and output
the operation result, in the same data type as (s), from (d).
Data type: INT
• Input an INT, DINT, REAL, or LREAL data type value to (s1) to (s28).
• If an underflow or overflow occurs in the operation result, the output from (d) will be as follows.
Ladder, FBD/LD
*1
Structured text
*1
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=ADD(s1,s2);
[With EN/ENO]
d:=ADD_E(EN,ENO,s1,s2);
Argument Description Type Data type
EN Execution condition (TRUE: Executed, FALSE: Not executed) Input variable BOOL
s1 (IN1) to s28 (IN28) Input Input variable ANY_NUM
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d Output Output variable ANY_NUM
Data type: INT Data type: DINT Data type: REAL/LREAL
• Even if an underflow or overflow occurs, no
operation error is issued. When ADD_E is used,
ENO outputs TRUE.
[Example 1]
32767+2=-32767
(7FFFH)+(0002H)=(8001H)
A negative value results because the most
significant bit is 1.
[Example 2]
-32767+(-2)=32766
(8000H)+(FFFEH)=(7FFEH)
A positive value results because the most
significant bit is 0.
• Even if an underflow or overflow occurs, no
operation error is issued. When ADD_E is used,
ENO outputs TRUE.
[Example 1]
2147483647+2=-2147483647
(7FFFFFFFH)+(00000002H)=(80000001H)
A negative value results because the most
significant bit is 1.
[Example 2]
-2147483648+(-2)=2147483646
(80000000H)+(FFFEH)=(7FFFFFFEH)
A positive value results because the most
significant bit is 0.
An operation error occurs and an undefined value
is output.
RnCPU
RnENCPU
RnSFCPU RnSFCPURnPCPURnPCPU
(Standard) (Safety)
(Redundant)
(Process)
EN ENO
ds1
s2
(s1)
(s2)
(d)
69125678+1234
INTINTINT