Delta Electronics AH — 3.4 Arithmetic Instructions

Chapter 3 Standard Instructions Graphic expression: 3_ S 1 : Augend S 2 : Addend D : Sum Explanation: 1. The binary-coded decimal value in S2 is added to the binary-coded decimal value in S1, 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: 5. When the binary-coded decimal values in S1 and S2 are 9999 and 0002 respectively, S1 plus S2 equals the 0001. binary-coded decimal value 10001. Since the carry is ignored, the binary coded-decimal value stored in D is 6.

The addition of 32-bit binary-coded decimal values: 7. When the binary-coded decimal values in S1 and S2 are 99999999 and 00000002 respectively, S1 plus S2 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.

3-87 FB/FC Instruction Operand Description FC D* B+ P S , S , D 1 2 Addition of binary-coded decimal numbers BOOL WORD DWORD LWORD UINT UDINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S , S 1 2  *  * D  *  * Device X Y M S T C HC/AC D L SM SR E PR K 16# “$” D F S , S 1 2             D           Pulse instruction 16-bit instruction 32-bit instruction AH Motion CPU AH Motion CPU AH Motion CPU