5 Categories and Use of Basic Application Instructions Operands: S : Source device D : Device for storing the result Explanation: 1. This instruction performs a square root operation on S and stores the result in D . 2. S can only be a positive value. Performing a square root operation on a negative value will result in an error and the instruction will not be executed. 3. The operation result D should be integer only, and the decimal will be left out. When decimal is left out, borrow flag M1969 = ON. 4. When the operation result D = 0, zero flag M1968 = ON. 5. Flags: a) If the absolute value of the converstion result > max. floating point value, carry flag will be ON.
b) If the absolute value of the conversion result c) If the conversion result is “0”, zero flag will be ON. Program Example: When X20 = ON, square root of D0 will be stored in D12. X20 D0 D12 DVP-PM Application Manual 5-69 API Mnemonic Operands Function Controllers 20PM 10PM D SQR P Square Root Type OP Bit Devices Word devices Program Steps X Y M S K H Kn X KnY KnM KnS T C D E F SQR, SQRP: 5 steps DSQR, DSQRP: 9 steps S * m * D * OX O100 Zero flag M1808 M1968 Borrow flag M1809 M1969 Carry flag M1810 M1970 SQR D0 D12