Square Root - Root(72) - Omron C200H Operation Manual

Hide thumbs Also See for C200H:
Table of Contents

Advertisement

BCD Calculations
5-17-14 SQUARE ROOT – ROOT(72)
Description
Flags
Example
Ladder Symbols
ROOT(72)
@ROOT(72)
Sq
R
When the execution condition is OFF, ROOT(72) is not executed. When the
execution condition is ON, ROOT(72) computes the square root of the
eight-digit content of Sq and Sq+1 and places the result in R. The fractional
portion is truncated.
R
Sq+1
ER:
Sq is not BCD.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ:
ON when the result is 0.
The following example shows how to take the square root of a four-digit num-
ber and then round the result.
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 required for the answer (because the number of digits in the
original value was doubled), is placed in DM 0102, and the digits are split into
two different words, the leftmost two digits to IR 011 for the answer and the
rightmost two digits to DM 0103 so that the answer in IR 011 can be rounded
up if required. The last step is to compare the value in DM 0103 so that IR
011 can be incremented using the Greater Than flag.
In the following example, √6017 = 77.56, and 77.56 is rounded off to 78.
Operand Data Areas
Sq: First source word (BCD)
IR, SR, AR, DM, HR, TC, LR
Sq
R
Sq
Section 5-17
R: Result word
IR, AR, DM, HR, LR,
177

Advertisement

Table of Contents
loading

Table of Contents