Yaskawa MP900 Series Ladder Programming Manual User Manual

Page 100

Advertising
background image

5.3 Numeric Operation Instructions

5.3.5 Extended Subtract (SUBX (

− −))

5-31

Instructions

5

( 3 ) Programming Examples

In the following programming examples, input data B is extended-subtracted from input data A and the result is stored
in the output data.

• Storing the Output Data in MW00000 When Input Data A Is -32,760 and Input Data B Is 10

-32,768 – – 10

→ MW00000 = 32,766

• Storing the Output Data in ML00000 When Input Data A in MW00002 Is -20,000 and Input Data B in

MW00003 Is 30,000
-20,000 – –30,000

→ ML00000 = 15,536*

∗ In the example given above, ML00000 does not equal -50,000 because both input data A and B are integers,

which limits the result to a number within the range for integers.

• Storing the Output Data in ML00000 When Input Data A Is -2,147,483,648 and Input Data B Is 2

-2,147,483,648 – – 2

→ ML00000 = 241,783,646

• Storing the Output Data in MW00000 When Input Data A Is 32,767 and Input Data B Is -1

32,767 – – -1

→ MW00000 = -32,768

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

Advertising
This manual is related to the following products: