3. Instruction Set Operands: S : Source device D : Operation result Explanations: 1. This instruction performs a square root operation on the floating point value in S and stores the result in D . All data will be operated in binary floating point format and the result will also be stored in floating point format. 2. If the source device S is specified as constant K or H, the integer value will automatically be converted to binary floating value. 3. If operation result of D is 0 (zero), Zero flag M1020 = ON. 4. S can only be a positive value. Performing any square root operation on a negative value will result in an “operation error” and instruction will not be executed.
M1067 and M1068 = ON and error code “0E1B” will be recorded in D1067. 5. Flags: M1020 (Zero flag), M1067 (Program execution error), M1068 (Execution Error Locked) Program Example 1: When X0 = ON, the square root of binary floating point (D1, D0) is stored in (D11, D10) after the operation of square root. X0 (D1, D0) (D11 D10) , Binary floating point Binary floating point Program Example 2: When X2 = ON, the square root of K1234 (automatically converted to binary floating value) is stored in (D11, D10).
X2 3-335 API Mnemonic Operands Function Controllers 127 D ESQR P Floating point square root ES2/EX2 SS2 SA2 SX2 SE Typ e OP Bit Devices X Y M S Word devices Program Steps Y M S K H KnX KnY KnM KnS T C D E F DESQR, DESQRP: 9 steps S * * * D * PULSE 16-bit 32-bit SA2 SA2 SA2 ES2/EX2 SS2 SX2 ES2/EX2 SS2 SX2 ES2/EX2 SS2 SX2 SE SE SE DESQR D0 D10 DESQR K1234 D10