11 - 36 11 - 36
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
CSNI
Instruction
Convert SiNgle to Integer
• Converts a single precision real number into a 2-word (32-bit) integer to be used by the
PLC CPU.
CSNI (single precision variable> , <array variable>
single precision variable
• • • •
Specify the single precision variable where the data
for conversion is stored.
Syntax
array variable
• • • •
Specify the one dimensional integer array variable
where the converted data is stored.
CSNI B!, A%(0)
• • • •
Converts the value of B! into 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 CSNI instruction converts a single precision real number into a 2-word (32-bit) integer
that is used by the PLC CPU.
• BASIC can handle a single precision real number 2.09 through 2.09.
An "Over flow" error occurs if the value exceeds this range.
If the converting single precision real number contains a fractional part, the fractional part
is rounded down, then converted.
• The following shows handling of BASIC’s single precision real number by the PLC CPU:
Example
PLC
CPU
BASIC
Stores in the data register.
Dn
Dn+1
PCWT (Control table) , %( )
%(n)
%(n+1)
Converts into a
2-word integer.
!
For <control table>,
see process code
1 of the PCWT instruction.
CSNI
%Value of (n)
%Value of (n+1)
• <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 used 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...