Description
The instruction "Form square root" is used form the square root from the value of the floating-point number at input IN and to write the result to output OUT. The instruction has a positive result if the input value is greater than zero. If input values are less than zero, output OUT returns an invalid floating-point number. If the value at input IN is "0", the result is also "0".
The enable output ENO has the signal state "0" if one of the following conditions applies:
-
Enable input EN has the signal state "0".
-
The value at input IN is not a valid floating-point number.
-
The value at input IN is negative.
Parameters
The following table shows the parameters of the instruction "Form square root":
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
|
|---|---|---|---|---|---|
|
S7-1200 |
S7-1500 |
||||
|
EN |
Input |
BOOL |
I, Q, M, D, L or constant |
I, Q, M, D, L, T, C or constant |
Enable input |
|
ENO |
Output |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L |
Enable output |
|
IN |
Input |
Floating-point numbers |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Input value |
|
OUT |
Output |
Floating-point numbers |
I, Q, M, D, L |
I, Q, M, D, L |
Square root of the input value |
You can select the data type of the instruction from the "???" drop-down list of the instruction box.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:
The following table shows how the instruction works using concrete operand values:
|
Parameters |
Operand |
Value |
|---|---|---|
|
IN |
Tag_Value |
25.0 |
|
OUT |
Tag_Result |
5.0 |
If the "TagIn" operand has signal state "1", the instruction is executed. The instruction calculates the square root of the operand "Tag_Value" and sends the result to output "Tag_Result". If the instruction is executed without errors, the "TagOut" output is set.