Tag Archives: Mitsubishi PLC CMP

Mitsubishi PLC command CMP

CMP is a comparison instruction for 16-bit data comparison. The comparison data range is -32768 to +32767. The comparison data type can be Changshu K, H, etc. It can be data register D or counter C. It can be a time relay. T, can also be a continuous address (such as K1X0, K2Y0, K3M0, K2S0, etc.).

The instructions are used as follows:
CMP D0 D2 M0
The instruction is a comparison instruction, and the results of the comparison <, =, > are respectively reported to M0, M1, M2.

If D0>D2, M0=1
If D0=D2, M1=1
If D0 < D2, M2=1

So using this instruction will continuously occupy three consecutive bit addresses headed by M0.
In addition, if the comparison data range is greater than 65535, please use DCMP, this is a double word comparison instruction, the usage is the same as CMP, but the comparison data is double word 32-bit data, so do not appear when using