Square Root (SQR/SQRT)

The SQR instruction computes the square root of the Source and places the result in the Destination.

Available Languages
-    Ladder Diagram
-    Function Block
-    Structured Text
Use SQRT as a function.

Operands
-    Ladder Diagram
Operand
Type
Format
Description
Source
SINT
INT
DINT
REAL
Immediate
tag
find the square root of this value
Destination
SINT
INT
DINT
REAL
tag
tag to store the result

-    Function Block
Operand
Type
Format
Description
SQR tag
FBD_MATH_ADVANCED
structure
SQR structure

-    Structured Text
Use SQRT as a function. This expression computes the square root of source and stores the result in dest.

dest := SQRT(source);

FBD_MATH_ADVANCED Structure

Input Parameter
Data Type
Description
EnableIn
BOOL
Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set.
Source
REAL
Find the square root of this value.
Valid = any float

Output Parameter
Data Type
Description
EnableOut
BOOL
Enable output.
Dest
REAL
Result of the math instruction. Arithmetic status flags are set for this output.

Example
Calculate the square root of value_1 and place the result in sqr_result.

-    Ladder Diagram
-    Function Block
-    Structured Text
sqr_result := SQRT(value_1);

File name: PLC-22_IS_CMI-SQR-SQRT.pdf
File size: 408.99 KB

0 comments :