Delta AH500 — 6.2.2 Explanation of Arithmetic Instructions

Chapter 6 Applied Instructions 6.2.2 Explanation of Arithmetic Instructions Symbol: S 1 : Augend Word/Double word S 2 : Addend Word/Double word D : Sum Word/Double word Explanation: 1. The binary value in S 2 is added to the binary value in S 1 , and the sum is stored in D . 2. Only the 32-bit instructions can use the 32-bit counter. 3. The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag) 4. When the operation result is zero, SM600 is ON. Otherwise, it is OFF. 5. The addition of 16-bit binary values: When the operation result exceeds the range of 16-bit binary values, SM602 is ON. Otherwise, it is OFF. 6. The addition of 32-bit binary values:

When the operation result exceeds the range of 32-bit binary values, SM602 is ON. Otherwise, it is OFF. Example 1: The addition of 16-bit binary values: When X0.0 is ON, the addend in D10 is added to the augend in D0, and sum is stored in D20.  When the values in D0 and D10 are 100 and 10 respectively, D0 plus D10 equals 110, and 110 is stored in D20.  When the values in D0 and D10 are 16#7FFF and 16#1 respectively, D0 plus D10 equals 16#8000, and 16#8000 is stored in D20.

6-37 API Instruction code Operand Function 0100 D + P S , S , D 1 2 Addition 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