Chapter 6 Applied Instructions API 0108 Symbol: S 1 : Augend Word/Double word S 2 : Addend Word/Double word D : Sum Word/Double word Explanation: 1. The binary-coded decimal value in S 2 is added to the binary-coded decimal value in S 1 , and the sum is stored in D . 2. Only the instruction DB+ can use the 32-bit counter. 3. The binary-coded decimal value is represented by the hexadecimal number, and every digit is within the range between 0 and 9. 4. The addition of 16-bit binary-coded decimal values: When the binary-coded decimal values in S 1 and S 2 are 9999 and 0002 respectively, S 1 plus S 2 equals the binary-coded decimal value 10001.
Since the carry is ignored, the binary coded-decimal value stored in D is 0001. 5. The addition of 32-bit binary-coded decimal values: When the binary-coded decimal values in S 1 and S 2 are 99999999 and 00000002 respectively, S 1 plus S 2 equals the binary-coded decimal value 100000001. Since the carry is ignored, the binary coded-decimal value stored in D is 00000001. Example: When X0.0 is ON, the constants 1234 and 5678 are converted into the binary-coded decimal values which are stored in D0 and D1 respectively. The binary-coded decimal value in D1 is added to the binary-coded decimal value in D0, and the sum is stored in D10.
6-53 Instruction code Operand Function D B+ P S , S , D 1 2 Addition of binary-coded decimal 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