Mitsubishi plc CMP comparison instruction
S1S2: KH KnX KnY KnM KnS TCDVZ
D: YMS
The compare instruction CMP compares the data of the source operand S1 with the source operand S2 and sends the result to the destination operand. Program example:
This is a three-operand instruction. It makes an algebraic comparison of the source operand data (eg -2<1). And the data of all source operands and the data of the target operand are processed as binary data. The M0M1M2 in the program acts according to the result of the comparison. When M100>C20 is the current value, M0 is turned on; when K100=C20 is the current value, M1 is turned on; when K100<C20 is the current value, M2 is turned on. When the execution condition X0 = OFF, the CMP instruction is not executed. The current value of M0M1M2 remains unchanged.
When the operand of the compare instruction is incomplete (such as specifying only one or two operands), the specified operand does not meet the requirements (such as specifying XDTC as the destination operand), or the component of the specified operand is out of the allowable range. The program will go wrong.
The practical application is as follows: the automatic floor display of the elevator is triggered by M1.
Construction And Building Staple
Construction And Building Staple,Construction 16 Gauge Nail,Fine Wire Staples,Medium Wire Staples
Zhejiang Best Nail Industrial Co., Ltd. , https://www.beststaple.com