Delta AH500 — 6.13.2 Explanation of Data Processing Instructions

Chapter 6 Applied Instructions Symbol: S : Matrix source Word n : Length of the array Word D : Operation result Word Explanation: 1. The instruction is used to count the bits with the value 1 or 0 in the n devices starting from the device specified by S . The operation result is stored in D . 2. When SM617 is ON, the bits with the value 1 is counted. When SM617 is OFF, the bits with the value 0 is counted. When the operation result is 0, SM618 is ON. 3. The operand n should be within the range between 1 and 256. Example: Suppose SM617 is ON. When X0.0 is ON, the bits with the value 1 are counted, and the operation result is stored in D20. Suppose SM617 is OFF.

When X0.0 is ON, the bits with the value 0 are counted, and the operation result is stored in D20. b0 b15 D0 D1 12 0 SM 617 D20 D2 36 1 SM 617 D20 Additional remark: 1. If S + n -1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. 2. If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B. 3. The flags: SM617: The bits with the value 0 or 1 are counted. SM618: It is ON when the matrix counting result is 0.

6-289 API Instruction code Operand Function 1214 MBC P S, n, D Counting the bits with the value 0 or 1 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 AH500 AH500 - 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1