Mitsubishi — Chapter 6 Application Instructions API 00-49

6 Application Instructions API 00-49 API 48 Operands: S : Source device D : Device for storing the result Explanations: 1. See the specifications of each model for their range of use. 2. Flags: M1020 (zero flag); M1021 (borrow flag); M1067 (instruction operation error) 3. This instruction performs a square root operation on S and stores the result in D . 4. S can only be a positive value. If S is negative, PLC will regard it as an “instruction operation error” and will not execute this instruction. M1067 and M1068 = On and D1067 records the error code 0E1B (hex). 5. The operation result D should be integer only, and the decimal will be left out. Borrow flag M1021 = On. 6.

When the operation result D = 0, zero flag M1020 = On. Program Example: When X10 = On, the instruction performs a square root on D0 and stores the result in D12. X10 D0 D12 DVP-PLC Application Manual 6-73 Mnemonic Operands Function D SQR P 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 SQR, SQRP: 5 steps DSQR, DSQRP: 9 steps S * * * D * PULSE 16-bit 32-bit EH3 EH3 EH3 ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV SV2 SV2 SV2 0 SQR D0 D12