(D) CMP (P) Comparison – This instruction performs an algebraic comparison between two source operating elements and sends the result to a target element to determine its state.
Source Operating Elements: K, H, KnX, KnY, KnM, KnS, TCDV/Z
Target Component: YMS
Format: LD X0
CMP(P) K100 C20 M0
When X0 turns ON from OFF:
If K100 > C20 current value, M0 = 1
If K100 = C20 current value, M1 = 1
If K100 < C20 current value, M2 = 1
The CMP instruction is executed once per scan cycle when the condition is met.
(D) ZMP (P) Interval Comparison – Compares one data value with the interval of two source components and sends the result to the target component.
Source Operating Elements: K, H, KnX, KnY, KnM, KnS, TCDV/Z
Target Component: YMS
Format: LD X0
ZCP(P) K100 K120 C30 M3
When X0 turns ON from OFF:
If K100 > C30 current value, M3 = 1
If K100 ≤ C30 ≤ K120, M4 = 1
If K120 < C30 current value, M5 = 1
The ZCP instruction is also executed once per scan cycle when the condition is satisfied.
(D) MOV (P) Transfer – Transfers the data from the source operating element to the target component.
Source Operating Elements: K, H, KnX, KnY, KnM, KnS, TCDV/Z
Target Components: KnY, KnM, KnS, TCDV/Z
Format: LD X0
MOV(P) K100 D10
When X0 turns ON, 100 is transferred to D10.
In continuous mode, it executes once per scan cycle when the condition is met.
For 32-bit data transfer using DMOV, component pairs are used. It’s recommended to use even numbers for the first component in each pair to avoid errors.
Constants are automatically converted to binary and stored in the target component during the transfer.
SMOV (P) Shift Transfer – Converts the source component's data into BCD code and shifts it to the target component as required.
Source Operating Elements: K, H, KnX, KnY, KnM, KnS, TCDV/Z
Target Components: KnY, KnM, KnS, TCDV/Z
Range for m: K/H is 1–4 (i.e., D1 must not exceed 9999).
n: KH
Example: D1 = 1685, D2 = 0
LD X0
SMOV(P) D1 K4 K2 D2 K3
When X0 turns ON:
Convert D1=1685 to BCD: 0001 0110 1000 0101
D2=0 becomes 0000 0000 0000 0000
Then, shift the rightmost 2 bits of D1's BCD code starting from the 4th bit to the 2nd position of D2, keeping the first and fourth bits unchanged. Now D2 = 0000 0001 0110 0000, which equals 160.
The SMOV instruction runs once per scan cycle when the condition is met.
(D) CML (P) Negated Transmission – Converts the source component’s data into binary and inverts each bit (0→1, 1→0), then transfers it to the target component.
Source Operating Elements: K, H, KnX, KnY, KnM, KnS, TCDV/Z
Target Components: KnY, KnM, KnS, TCDV/Z
Example: D0 = 11
LD X0
CML(P) D0 K1Y0
When X0 turns ON:
D0 = 11 → Binary: 1010 → Inverted: 0101
Output: Y0 = 0, Y1 = 1, Y2 = 0, Y3 = 1
The CML instruction is executed once per scan cycle when the condition is met.
Share this content with PLC enthusiasts and keep learning!
Harness Tester,Automotive Wiring Loom,Electric Wire Splicers,Electrical Wire Connectors
Kunshan Bolun Automation Equipment Co., Ltd , https://www.bolunmachinery.com