Omron C200HE User Manual

Page of 564
241
5-19-14 SQUARE ROOT – ROOT(72)
Sq: First source word (BCD)
IR, SR, AR, DM, HR, TC, LR
R: Result word
IR, SR, AR, DM, HR, LR,
Ladder Symbols
Operand Data Areas
ROOT(72)
Sq
R
@ROOT(72)
Sq
R
Limitations
Sq and Sq+1 must be in the same data area.
Description
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-dig-
it content of Sq and Sq+1 and places the result in R. The fractional portion is trun-
cated.
R
Sq+1
Sq
Flags
ER:
Sq or Sq+1 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.
Example
The following example shows how to take the square root of a four-digit number
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 num-
ber 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 differ-
ent 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.
BCD Calculations
Section 5-19