8 Application Instructions API 100-149 API 127 Operands: S : Source device D : Operation result Explanations: 1. Range of S : ≥ 0 2. See the specifications of each model for their range of use. 3. Flags: M1020 (zero flag); M1067 (operation error) 4. This instruction performs a square root operation on the content in the register designated by S and stores the result in the register designated by D . The square root operation is performed in floating point system. 5. If S is an designated constant K or H, the instruction will convert the constant into a binary floating point value before the operation. 6. If the result of the operation = 0, the zero flag M1020 = On. 7.
S can only be a positive value. Performing any square root operation on a negative value will result in an “operation error” and this instruction will not be executed. M1067 and M1068 will be On and D1067 will record the error code H’0E1B. Program Example 1: When M0 = On, calculate the square root of the binary floating point (D1, D0) and store the result in register (D11, D10). X0 (D1, D0) (D11 D10) , binary floating point binary floating point Program Example 2: When M2 = On, calculate the square root of K1,234 (automatically converted into binary floating point) and store the result in register (D11, D10). X2 Remarks: For floating point operations, see “5.3 Handling of Numeric Values”.
DVP-PLC Application Manual 8-43 Mnemonic Operands Function D ESQR P Floating Point Square Root Type OP Bit Devices Word Devices Program Steps X 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 EH3 SV2 ES EX SS SA SX SC EH SV EH3 SV2 EH3 ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV SV2 DESQR D0 D10 DESQR K1234 D10