EasyManua.ls Logo

Omron CP - PROGRAMMING MANUAL 05-2007 - Page 487

Omron CP - PROGRAMMING MANUAL 05-2007
1175 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
454
Special Math Instructions Section 3-13
Description ROOT(072) computes the square root of the 8-digit BCD number in S+1 and
S and outputs the integer portion of the result to R. The non-integer remainder
is eliminated.
Flags
Precautions The operands of this instruction (S+1, S, and R) are all treated as BCD val-
ues. If the input data is binary, use the ROTB(620) instruction.
Examples Square Root of 8-digit Number
When CIO 0.00 is ON in the following example, ROOT(072) calculates the
square root of the data in D101 and D100, and writes the integer portion of
the result in D200.
Note Figures after the decimal point are truncated for 8-digit numbers.
Square Root of a 4-digit Number
The following example shows how to take the square root of a 4-digit number
and round off the result. This program example calculates the square root of
the 4-digit number in CIO 1000, rounds off the result, and writes it to
CIO 2000. (Basically, the 4-digit number is multiplied by 10,000 (100
2
) and the
result is divided by 100, increasing the precision of the calculation by a factor
of 100.)
Indirect DM addresses
in BCD
*D0 to *D32767
Constants #00000000 to #99999999
(BCD)
---
Data Registers --- DR0 to DR15
Index Registers ---
Indirect addressing
using Index Registers
,IR0 to ,IR15
–2048 to +2047 ,IR0 to –2048 to +2047 ,IR15
DR0 to DR15, IR0 to IR15
,IR0+(++) to ,IR15+(++)
,–(– –)IR0 to, –(– –)IR15
Area S R
RS+1 S
BCD data (8 digits) BCD data (4 digits)
Name Label Operation
Error Flag ER ON if the data in S+1 and S is not BCD.
OFF in all other cases.
Equals Flag = ON if the result is 0000.
OFF in all other cases.
0.00
D100
D200
S+1: D101 S: D100 R: D200
Truncated

Table of Contents

Related product manuals