![Omron CVM1D Скачать руководство пользователя страница 316](http://html1.mh-extra.com/html/omron/cvm1d/cvm1d_operation-manual_742532316.webp)
311
The following example shows how to take the square root of a 4-digit number
and then round the result.
When CIO 000000 is ON, first the words to be used are cleared to all zeros and
then the value whose square root is to be taken is moved to Sq+1. The result,
which has twice the number of digits as the correct answer (because
ROOT(140) operates on an 8-digit number and here we are using a 4-digit num-
ber), is placed in D00102, and the digits are split into two different words, the
leftmost two digits to CIO 0011 for the answer and the rightmost two digits to
D00103 so that the answer in CIO 0011 can be rounded. The last step is to com-
pare the value in D00103 so that CIO 0011 can be incremented using the Great-
er Than Flag (A50005) when the value must be rounded up.
In this example,
√
6017 = 77.56. The result is rounded off to an integer, according
to the digit in the tenths place. Thus, 77.56 is rounded off to 78.
00000
LD
000000
00001
j
BSET(041)
#0000
D00100
D00101
00002
j
MOV(030)
0010
D00101
00003
j
ROOT(140)
D00100
D00102
00004
j
MOV(030)
#0000
0011
00005
j
MOV(030)
#0000
D00103
00006
j
MOVD(043)
D00102
#0012
0011
00007
j
MOVD(043)
D00102
#0210
D00103
00008
j
CMP(020)
D00103
#4900
00009
LD
A50005
00010
j
INC(090)
0011
010
6
0
1
7
D00101
D00100
0
0
0
0
0
0
0
0
0000
D00101
D00100
6
0
1
7
0
0
0
0
D00102
7
7
5
6
0011
D00103
0
0
7
7
5
6
0
0
0000
60170000= 7756.932
D00103
0011
0
0
0
0
0
0
0
0
0000
0000
5600 > 4900?
0011
0
0
7
8
Address
Instruction
Operands
(041)
j
BSET
#0000
D00100
D00101
(030)
j
MOV
0010 D00101
(140)
j
ROOT D00100
D00102
(030)
j
MOV
#0000
0011
(030)
j
MOV
#0000 D00103
(043)
j
MOVD
D00102
#0012
0011
(043)
j
MOVD
D00102
#0210
D00103
(020)
j
CMP
D00103
#4900
(090)
j
INC
0011
0000
00
A500
05
Example
Special Math Instructions
Section 5-23
Содержание CVM1D
Страница 462: ...SYSMAC CVM1D Duplex System Programmable Controllers Operation Manual Revised August 2001...
Страница 463: ...iv...
Страница 465: ...vi...