11 - 14 11 - 14
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
CDBI
Instruction
Convert DouBle to Integer
• Converts a double precision real number to a 2-word (32-bit) integer used by the PLC
CPU.
CDBI <double precision variable> , <array variable>
double precision variable
• • • •
Specify the double precision variable where the data
to be converted is stored.
Syntax
array variable
• • • •
Specify the one dimensional integer array variable
where the converted data is stored.
CDBI B#, A%(0)
• • • •
Converts the value of B# to an integer and stores in
A%(0) and A%(1).
Examples
L
H
L
H
A%(0)
A%(1)
B#
Lower word
Higher word
32 bits
Description
• The CDBI instruction converts a double precision real number to a 2-word (32-bit) integer
used by the PLC CPU.
• BASIC can handle a double precision real number of 2147483648 through 2147483647.
An
"
Over flow
"
error occurs if the value exceeds this range.
If the converting double precision real number contains a fractional part, the fractional part
is rounded down, then converted.
• The following illustrates handling of BASIC’s double precision real number by the PLC:
Example
PLC
CPU
BASIC
Stores in the data register.
Dn
Dn+1
PCWT
%( )
%(n)
%(n+1)
Converts to a
2-word integer.
#
For <control table>,
see process code1
of the PCWT instruction.
CDBI
%Value of (n)
%Value of (n+1)
2-word integer
(Control table) ,
• <array variable> uses a one dimensional integer array variable.
An “Illegal function call” error occurs if anything other than the one dimensional integer
array variable is specified.
Be sure to define the variable to use for <array variable> by the DIM instruction.
If it is not defined by the DIM instruction, an "Illegal function call" error occurs.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...