I have a ladder diagram for timing porpose.(keyence KV-24DR) some instructions are repeated many times but I dont understand what are these for. can anybody help me?

the confusing thing is that the program increments a number(I think it should be positive) and then compares it with '0' !!!

enter image description here 2002: Always ON relay

LDA(DM0021): load A from data memory #0021

ADD(#00001): Adds value specified by operand to contents of internal register, and inputs result back to same internal register.

CMP(#00000): Compares content of internal register and value specified by operand.

DW(#00000)(DM#00021): writes #00000 to data memory #000021

enter image description here here is keyence programming manual:



1 Answer 1


The logic is just clamping each of the variables DM0021, 22 and 23 to the range 0 to 99. If it is inside the limits it leaves it alone.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.