Chapter 6 Applied Instructions 5. Dividing 32-bit values: Quotient Remainder S 1 S 2 S 1 S 2 +1 D+1 D D+3 D+2 +1 b15.....b0 b15.....b0 b15.....b0 b15.....b0 b15.....b0 b15.....b0 b15.....b0 b15.....b0 / = The operand D occupies two devices. The quotient is stored in ( D +1, D) , and the remainder is stored in ( D +3, D +2). Example When M0 is ON, the instruction divides the dividend in D0 by the divisor in D10, and stores the quotient in D20, and stores the remainder in D21. Whether the result is a positive value or a negative value depends on the state of the highest bit. Additional remarks 6_ 1.
If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. 2. If the divisor is 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2012. 3. If you declare the operand D used during the execution of the 16-bit instruction in ISPSoft, the data type is ARRAY [2] of WORD/INT. 4. If you declare the operand D used during the execution of the 32-bit instruction in ISPSoft, the data type is ARRAY [2] of DWORD/DINT. 6-55