Very Basic and Easy Ladder Logic Question

S

Thread Starter

Scott M.

Suppose I have rung with two inputs and an output. The first input is a normally open contact and the second intput is an IF instruction.

For my IF statement I have: IF F0829 > 0
My LET statement is: LET F0829 = F0939

Preceding both of these statements is a normally open contact.

The question I have is will F0939 be zero whenever the contact is open? Register F0939 is mentioned no where else in the logic program I am using. It's only occurence is in the aformentioned rung. The rung will be used to control the visibility of templates on an HMI.

The last question I have is, for the instruction,
LET F0829 = F0939, does this mean that the contents of F0829 are moved into F0939 so as to empty and zero out F0829, or, are the contents simply copied from F0829 into F0939?

Thank you very much for your help.
 
A
First let me say that normally a let statement will make the left hand side be made equal to the right hand side i.e let x=y, x will be loaded with
the contents of y.
Putting that aside and not knowing what plc you are using, a function on a rung if it is not purely bit logic will require continuity from the left hand side rail to enable it.
If the proceeding contact is open then no "power" flows to the instruction and so it does not get executed.
So the "x" part of you let statement will remain set at its previous value.
hope this helps
 
J

Joe Jansen/ENGR/HQ/KEMET/US

Not sure what PLC this is, but as a general rule:

First off: Given the sequence you show, F0939 will never be changed.
F0829 will change to equal what is in F0939 when energized. In an
assignment command, the variable to the left of the = sign is the assignee,
and the variable/value to the right of the = sign is the assignment. Thus
LET F0001 = 0 will put a 0 into F0001. Perhaps you mean LET F0939 = F0829?
I will assume for the rest of the discussion that this is what you
mean.....

Question 1: No. F0939 will keep it's last state. If you want it to be
zero whenever it is not energized, put an unconditional LET F0939 = 0 in
the rung immediately prior to the rung in question. If you rung in
question is energized, it will be changed again to equal the contents of
F0829. If it is not energized, it will stay zero.

Second question: No again. Assignment operators are copies, not moves.
At the end of the LET command, both values will be equal (thus the = sign).
You can prove this by immediately doing an IF F0829 = F0939 and set a bit.
It should come on, proving that the values are the same.


Note that what I write is true for all the PLC's I have ever worked with,
but there may be some obscure brand out there that this is not true for. I
am fairly confident in the answers given above, however...

--Joe Jansen
 
Top