Chapter 17 Arithmetic Operation Functions; Addition - Mitsubishi MELSEC iQ-F FX5 series Programming Manual

Melsec iq-f fx5 series
Hide thumbs Also See for MELSEC iQ-F FX5 series:
Table of Contents

Advertisement

17
ARITHMETIC OPERATION FUNCTIONS
17.1

Addition

ADD(_E)
These functions output the sum of input values ((s1) + (s2) + ... + (s28)).
*1
Ladder diagram
[Without EN/ENO]
s1
d
s2
*1 The input variable "s" can be changed in the range of 2 to 28.
Setting data
■Descriptions, types, and data types
Argument
Description
EN
Execution condition (TRUE: Execution, FALSE: Stop)
s1 to s28
Input
ENO
Output status (TRUE: Normal, FALSE: Abnormal)
d
Output
Processing details
■Operation processing
• These functions add the INT, DINT, or REAL type data ((s1) + (s2) + ... + (s28)) input to (s1) to (s28), and output from (d) in
the same data type as (s).
Ex.
Data type is the INT type
(s1)
(s2)
1234
5678
INT
INT
• A value input to (s1) to (s28) is the INT, DINT, or REAL type data value.
• If an underflow and an overflow occur in the operation result, the result will be output as follows from (d).
Data type is INT
• Even if underflow or overflow occurs in the
operation result, it is not regarded as an
operation error. "ADD_E" outputs "TRUE" from
ENO.
[Example 1]
32767+2=1
(7FFFH)+(0002H)=0001H
The most significant bit becomes 0, and the carry
flags (SM716 and SM8022) turn on.
[Example 2]
-32768+(-2)=-1
(8000H)+(FFFEH)=(FFFFH)
The most significant bit becomes 1, and the borrow
flag (SM8021) turns on.
• When the operation result is 0, the zero flag (SM8020) turns on.
[With EN/ENO]
EN
ENO
s1
d
s2
(d)
6912
INT
Data type is DINT
• Even if underflow or overflow occurs in the
operation result, it is not regarded as an
operation error. "ADD_E" outputs "TRUE" from
ENO.
[Example 1]
2147483647+2=1
(7FFFFFFFH)+(0002H)=(00000001H)
The most significant bit becomes 1, and the carry
flags (SM716 and SM8022) turn on.
[Example 2]
-2147483648+(-2)=-1
(80000000H)+(FFFEH)=(7FFFFFFFH)
The most significant bit becomes 1, and the borrow
flag (SM8021) turns on.
*1
Structured text
[Without EN/ENO]
d:=ADD(s1,s2);
[With EN/ENO]
d:=ADD_E(EN,ENO,s1,s2);
Type
Input variable
Input variable
Output variable
Output variable
Data type is REAL
An operation error occurs and an undefined value
is output.
17 ARITHMETIC OPERATION FUNCTIONS
17
Data type
BOOL
ANY_NUM
BOOL
ANY_NUM
777
17.1 Addition

Advertisement

Table of Contents
loading

Table of Contents