Yaskawa MP900 Series Ladder Programming Manual User Manual
Page 94

5.3 Numeric Operation Instructions
5.3.2 Add (ADD (+))
5-25
Instructions
5
( 3 ) Programming Examples
In the following programming examples, input data A and input data B are added and the result is stored in the output
data.
• Storing the Output Data in MW00000 When Input Data A Is 100 and Input Data B Is 200
100 + 200
→ MW00000 = 300
• Storing the Output Data in MW00000 When Input Data A Is 10.5 and Input Data B Is 10
10.5 + 10
→ MW00000 = 20 (when truncating below the decimal point is set)
• Storing the Output Data in ML00000 When Input Data A in MW00002 Is 20,000 and Input Data B in MW00003
Is 30,000
MW00002 (20,000) + MW00003 (30,000)
→ ML00000 = 32,767*
∗ In the example given above, an overflow error occurs because both input data A and B are integers, which lim-
its the result to a number within the range for integers.
( 4 ) Additional Information
With integer operations, an overflow operation error occurs if the result exceeds 32,767 and an underflow operation
error occurs if the result is less than -32,768.
With double-length integer operations, an overflow operation error occurs if the result exceeds 2,147,483,647 and an
underflow operation error occurs if the result is less than -2,147,483,648.
When performing operations with different data types, the result of the operation will depend on the data type of the output reg-
ister.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
Normally, addition and subtraction instructions (+, –, ++, and – –) involving double-length integers are performed as 32-bit
operations.
However, these instructions are performed as 64-bit operations if they are used to correct the remainder produced by an immedi-
ately preceding MUL instruction (
×) and are immediately followed by a DIV instruction (÷).
INFO