Yaskawa MP2000 Series: User's Manual for Motion Programming User Manual

Page 78

Advertising
background image

6 Variables (Registers)

6.1.2 Global Variables and Local Variables

6-6

Precautions for Variable Operations
Storing data in a variable of a different data type will result in:

Format

• Use a Substitute command (=).
• Write a destination register on the left and the operation on the right.

MW00100 = MW00101 + MW00102;

Variable
Operations

• When real number data is stored in an integer type variable.

MW00100 = MF00200; The real number data is converted into integer
(00001) (1.234) data and stored in the destination register.

Note: Be careful to avoid a round-off error, caused when storing real number data

into an integer type variable.
Specify the round-off method when storing the real number in an integer
type variable in the Motion Program Configuration Definition window.

MW00100 = MF00200 + MF00202;
(0124) (123.48) (0.02) The operation result will differ depending
(0123) (123.49) (0.01) on the variable values to be calculated.

• When real number data is stored in a double integer type variable.

ML00100 = MF00200; The real number data is converted to integer
(65432) (65432.1) data and stored in the destination register.

• When double integer data is stored in an integer type variable.

MW00100 = ML00200; The lower 16 bits of double integer data are
(-00001) (65535) stored in the destination register as they are.

• When integer data is stored in a double integer type variable.

ML00100 = MW00200; The integer data is converted to double integer
(0001234) (1234) data and stored in the destination register.

Operations that
Cause Syntax
Errors

• When integer data is stored in a bit type variable,

MB000100 = 123; => Syntax error
MB000100 = MW00100; => Syntax error

IMPORTANT

Advertising