AH500 Programming Manual Symbol: S : Data source Word/Double word n : Data length Word/Double word D : Operation result Double word/Long word Explanation: 1. The signed decimal values in S ~ S + n -1 are added up, and the sum is stored in the register specified by D . S Binary values +1 S +2 S n D D +1 +4 S +3 S +5 S Binary value S +1 S D D +1 Binary values n D D +3 +2 Binary value 2. The operand n used in the 16-bit instruction should be within the range between 1 and 256, and the operand n used in the 32-bit instruction should be within the range between 1 and 128. 3. Only the 32-bit instructions can use the 32-bit counter. Example:
When the instruction WSUM is executed, the values in D0~D2 are added up, and the sum is stored in D10. 6-294 API Instruction code Operand Function 1217 D WSUM P S, n, D Getting the sum Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S n D Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 S+3 S+2 S+5 S+4 S+7 S+6 S+9 S+8