BSQR

BSQR, BSQRP, BDSQR, BDSQRP

 

BSQR instruction computes the square root of source (BCD) and saves the result to the Destination.

(It supports only in XP and PLC-S CPU series)

 

S

Source

D

Destination

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

 

Error

Zero

Carry

BSQR(P)

BDSQR(P)

S

o

o

o

o

o

-

-

-

-

o

o

o

o

3

o

-

-

D

o

-

o

o

o

-

-

-

-

o

o

o

o

 

 

BSQR. BSQRP

When enabled, the BSQR instruction calculates the square root of BCD source and saves the result in Destination.

 

  • The source, D and D+1 are the BCD value. (0~9999)

  • The fraction (decimal point) is rounded off the numbers to five decimal places. Therefore, the 4 decimal place has tolerance of 1.

 

Example)

If M00 is ON, the MOV instruction copies the BCD value H1234 to the D90.

The BSQR instruction calculates the square root of D90 and saves its result in D100.

The integer part is stored in the D100 and the decimal point is stored in the D101.

 

 

 

 

BDSQR. BDSQRP

When enabled, the BDSQR instruction calculates the square root of BCD source and saves the result in Destination.

 

  • The S, S+1, D and D+1 are the BCD value. (0~99999999)

  • The fraction (decimal point) is rounded off the numbers to five decimal places. Therefore, the 4 decimal place has tolerance of 1.

 

Example)

If M00 is ON, the MOV instruction copies the BCD value H12345678 to the D90 and D91.

The BDSQR instruction calculates the square root of D90 and D91 and saves its result in D100 and D101.

The integer part is stored in the D100 and the decimal point is stored in the D101.