beautypg.com

Yaskawa MP900 Series Motion Programming Manual User Manual

Page 176

background image

Variables (Registers)

5.1.2 Global Variables and Local Variables

5 -6

J

Precautions on Variable Operations

Commands that Generate Errors

An error will result in commands such as the following:

D

Integer Data Stored in Bit Variables

MB000100 = 123;

MB000100 = MW00100;

Data Stored in Variables of Different Data Types

When data is stored in variables of a different data type, results such as the following will be
obtained:

D

Real Number Data Stored in Integer Variables

MW00100 = MF00200;

(00001)

(1.234)

Real number values are converted to integers and stored.

D

Real Number Data Stored in Double Integer Variables

ML00100 = MF00200;

(123457)

(123456.7)

Real number values are converted to integers and stored.

D

Double Integer Data Stored in Integer Variables

MW00100 = ML00200;

(−00001)

(65535)

The lower 16 bits of double integer data is stored as it is.

D

Real Number Data Stored in Double Integer Variables

ML00100 = MW00200;

(0001234)

(1234)

Integer data is converted to double integer data and stored.

Real Number Data Stored in Integer Variables

Be careful of rounding errors when real number data is stored in integer variables.

MW00100 = MF00200 + MF00202;

(0124)

(123.48)

(0.02)

(0123)

(123.49)

(0.01)

The operation result will vary according to the value of the variable being calculated.

5

IMPORTANT

This manual is related to the following products: