Chapter 6 Applied Instructions Symbol: S : Source device Word/Double word D : Device in which the result is stored Word/Double word Explanation: 1. After the square root of the value in the device specified by S is calculated, the integer part is stored in the device specified by D , and the fractional part is stored in the device specified by D+1 . 2. The 16-bit value in S should be within the range between 0 and 9,999, and the 32-bit value in S should be within the range between 0 and 99,999,999. 3. If the instruction BSQR is used, the square root is rounded down to the fourth decimal place. 4. If the instruction DBSQR is used, the square root is rounded down to the eighth decimal place.
5. If the operation result stored in D is 0, SM600 is ON. Example 1: After the square root of the value in D0 is calculated, the integer part is stored in Y0, and the fractional part is stored in Y1. 1 1 2 4 3 D0 MOV Y0 2 BSQR Integer part 16#1234 Binary-coded decimal value 0 5 3 0 Binary-coded decimal value Y1 Fractional part Binary-coded decimal value Example 2: After the square root of the value in D0 is calculated, the integer part is stored in Y0, and the fractional part is stored in Y1.
6-349 API Instruction code Operand Function 1518 D BSQR P S, D Square root of the binary-coded decimal number Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S D Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 1 2 8 3