On the other hand, there are those like yourself who don't really KNOW Relay Ladder Logic, and assume that it must be like other computer programming languages. The question was NOT about ANY computer programming language, but was about using PLC ladder logic to SIMULATE relay-type logic. You can only simulate RLL logic with PLC logic, not duplicate it, because in RLL logic, all devices are being evaluated at every instant (not dependent on a scan cycle)....who don't care what other programming languages mean and who keep comparing a plc to a relay logic.
It is not an assumption in Relay Ladder Logic (we are talking about hard-wired, physical relay coils here). It is pure fact that if a relay has no TRUE input, it will be OFF or NOT TRUE or 0. But you cannot compare this to the crippled IF-THEN statement in most computer languages (which needs additional help to reset the result)....my way and Lancie's method makes assumptions that without A then not B.
On the other hand, there are those like yourself who don't really KNOW Relay Ladder Logic, and assume that it must be like other computer programming languages.
This is good but
A :=B;
is simpler.
I always forget to turn bits off in structured text coding which is what I believe Peter was indicating
I personally think that you should use B := A when you mean B := A and If A then B:= 1 when you mean If A then B:= 1Another reason to use B := A instead of If A then B:= 1 in ST languages.
I personally think that you should use B := A when you mean B := A and If A then B:= 1 when you mean If A then B:= 1
I mean, you should be fully aware what every instuction you use, means, and use it accordingly.
I use the IF to determine if the condition to go from one state to another is satisfied. Using IF and ELSIF you can make sure only one condition is satisfied:
CASE State OF
INIT:
IF PowerOK AND EStopOK AND ResetPulse THEN
State := READY;
END_IF
READY:
IF NOT (PowerOK AND EStopOK) THEN
State := INIT;
ELSIF NOT HomeOK THEN
State := HOME;
ELSIF StartButton THEN
State := MOVEFAST;
ELSIF JogButton THEN
State := MOVESLOW;
ELSIF TeachInButton THEN
State := MOVETEACH;
END_IF
...
This is a way of programming that is not so easy to convert to ladder. And this is the question I'm adressing.
The Plc manufactured create 3 type category of programming language,
1.) ST
2.) Function Chart
3.) Ladder Logic.
Maybe my opinion are wrong.