Chapter 6 Applied Instructions Symbol: S 1 : Dividend Word/Double word S 2 : Divisor Word/Double word D : Quotient; remainder Word/Double word Explanation: 1. The singed binary value in S 1 is divided by the signed binary value in S 2 . The quotient and the remainder are stored in D . 2. Only the 32-bit instructions can use the 32-bit counter. 3. When the sign bit is 0, the value is a positive one. When the sign bit is 1, the value is a negative one. 4. The division of 16-bit values: Quotient Remainder S 1 S 2 D+1 D b15..............b0 b15..............b0 b15..............b0 b15..............b0 The operand D occupies two consecutive devices.
The quotient is stored in D , and the remainder is stored in D +1. 5. The division of 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 X0.0 is ON, the dividend in D0 is divided by the divisor in D10, the quotient is stored in D20, and the remainder is stored in D21. Whether the result is a positive value or a negative value depends on the state of the highest bit.
6-43 API Instruction code Operand Function 0103 D / P S , S , D 1 2 Division of binary numbers Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S 1 S 2 D Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500