9 Application Instructions API 150-199 API 185 Operands: S 1 : Matrix source device 1 S 2 : Matrix source device 2 n : Array length D : Pointer (Pr), for storing the value of target location Explanations: 1. Range of n : K1 ~ K256 2. S 1 , and S 2 designate KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. 3. SA/SX/SC can designate n = 4. EH/EH2/SV/EH3/SV2 can designate n ≦ 4 . 4. See the specifications of each model for their range of use. 5. Flags: M1088 ~ M1092. See remarks for more details. 6. This instruction compares every bit in S 1 with every bit in S 2 starting from location D + 1 and finds out the 7.
The matrix comparison flag (M1088) decides to compare between equivalent values (M1088 = 1) or different location of different bits. The location will be stored in D . values (M1088 = 0). When the comparison is completed, it will stop immediately and the matrix bit search flag will turn “On” (M1091 = 1). When the comparison progresses to the last bit, the matrix search end flag (M1089) will turn “On” and the No. where the comparison is completed is stored in D . The comparison will start from the 0 th bit in the next scan period when the matrix search start flag turns “On” (M1090 = 1). When D exceeds the range, the pointer error flag will turn “On” (M1092 = 1). 8.
The matrix operation will need a 16-bit register to designate a point among the 16n points in the matrix for the operation. The register is the Pointer (Pr) of the matrix, designated by the user in the instruction. The vaild range of Pr is 0 ~ 16n -1, corresponding to b0 ~ b16n-1 in the matrix. Please avoid changing the Pr value M1092 will be On and the instruction will not be executed. during the operation in case the comparing and searching will not ne correct. If the Pr value exceeds its range, 9. When M1089 and M1091 take place at the same time, both flags will be “1” at the same time. Program Example: 1. When X0 goes from Off to On, the matrix search start falg M1090 = 0.
The searching will start from the bit marked with “*” (current Pr value +1) for bits of different status (M1088 = 0). 2. Set the Pr value D20 = 2. When X0 goes from Off to On for 4 times, we can obtain the 4 execution results , , , . D20 = 5, M1091 = 1, M1089 = 0. DVP-PLC Application Manual 9-101 Mnemonic Operands Function MCMP P Matrix Compare Type OP Bit Devices Word Devices Program Steps X Y M S K H KnX KnY KnM KnS T C D E F MCMP, MCMPP: 9 steps S 1 * * * * * * * S 2 * * * * * * * n * * * D * * * * * * * * PULSE 16-bit 32-bit EH3 ES EX SS SV EH3 SV2 ES EX SS SA SX SC EH SV EH3 SV2 ES EX SS SA SX SC E H SV SA SX SC EH SV2