4 - 1 4 - 1
MELSEC-Q
4 THE EXCHANGE BETWEEN THE PLC AND BUFFER MEMORY
4
4 THE EXCHANGE BETWEEN THE PLC AND BUFFER MEMORY
4.1 PLC Numeric Data and BASIC Numeric Data
Data handled within the PLC are generally integers. It handles integers (not including
decimals) between –32768 and 32767 for one word (16 bits) and –2147483648
through 2149483647 for two words (32 bits).
However, data handled within BASIC are generally real numbers and integers. It
handles real numbers from (10
-38
through 10
38
) integers from –32768 through 32767
(not including decimals).
As shown above, data is handled differently between the PLC and BASIC. Therefore, it
is necessary to perform data conversion between real numbers and integers to
communicate with the PLC.
• 1-word processing
Real
Number
Integer
CINT function
Real number
Real Number
Integer
Integer
CDBL/CSNG Function
BASIC
BASIC
PLC CPU
PLC CPU
PLC CPU
BASIC
• 2-word processing
CISN/CIDB
function
CSNI/CDBI
function
Integer x 2
(Saved in an array)
Real number
BASIC
The 2-word integer
value is divided into
upper 16 bit and
lower 16 bit.
The two 1-word integer
values are placed together
as upper level and lower
level and treated as
a 2-word integer.
2-word
integer value
PLC