Chapter 6 Applied Instructions Symbol S 1 : Matrix source device 1 S 2 : Matrix source device 2 n : Length of the array D : Pointer 6_ Explanation 1. This instruction searches for the bits with different states, starting from the bits specified by adding one to the current value in D . After finding the bits with different states, the instruction stores the bit number in D , and the comparison is finished. 2. The operand n must be between 1–256. 3. When SM607 is ON, the equivalent values are compared. When SM607 is OFF, the different values are compared. When the matching bits are found, the comparison stops immediately, and SM610 is ON.
When the last bits are compared, SM608 is ON, and the bit number is stored in D . The comparison starts from the 0 th bits in the next scan cycle, and SM609 is ON. When the value in D exceeds the range, SM611 is ON. 4. When the MCMP instruction is executed, you need a 16-bit register to specify a certain bit among the 16 n bits in the matrix for the operation. The register is called the pointer, and is specified by you. The value in the register is between 0–16 n -1, and corresponds to the bit between b0 to b16 n -1. During the operation, you are prevented from exceeds the range, SM611 is ON, and the MCMP instruction is not executed.
altering the value of the pointer in case the search for the matching bits is affected. If the value of the pointer 5. If SM608 and SM610 occur simultaneously, they are ON simultaneously. 6-33 API Instruction code Operand Function 0058 MCMP P S1,S2,n,D Matrix comparison Device X Y M S T C HC D FR SM SR E K 16# “$” F S1 S2 n D BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S1 S2 n D Pulse Instruction 16-bit instruction 32-bit instruction ES3 ES3 -