The Commander
Member
We are moving from Allen-Bradley to Beckhoff and have discovered a construct that behaves in unexpected ways.
If we use the built-in MOVE block to the right of a FALSE N.O. contact, that MOVE is not executed, the output variable is untouched, and the ENO pin is FALSE. This works exactly as expected and is illustrated in Example 3 (attached).
However, if we wrap the MOVE within a FUNCTION or PROGRAM POU, the Output variable of the POU is disturbed even when the EN pin is FALSE. For a FUNCTION POU (Example 1) the output variable will be set to zero. For a PROGRAM POU (Example 2) the output variable will be set to the last output value when the EN pin was TRUE. Also, the ENO pin will be TRUE when the EN pin is FALSE.
We have situations were we want to run certain POUs conditionally, and only update the output variable(s) when THE EN pin is TRUE. The logic inside those POUs is more substantial than just a MOVE, but we use a MOVE to illustrate this issue.
As of right now our logic won't work properly because even when the EN pin is FALSE, output variables are modified.
We are looking at IEC 61131-3 but don't see where this situation is explicitly covered, but are still studying the reference we have (Heinz & Tiegelkamp), Springer.
Any thoughts on this?
When reviewing the examples be sure to note variable values in the data table above the code. The values shown alongside the variables in the LD seem to be truncated by TwinCAT.
Example 3 is the gold standard. If we could get either of the other two Examples to work the same way, then we would be back in business.
Your comments on this are appreciated!
Thank you!
View attachment POU_Output_Variables_Example_1.pdf
View attachment POU_Output_Variables_Example_2.pdf
View attachment POU_Output_Variables_Example_3.pdf
If we use the built-in MOVE block to the right of a FALSE N.O. contact, that MOVE is not executed, the output variable is untouched, and the ENO pin is FALSE. This works exactly as expected and is illustrated in Example 3 (attached).
However, if we wrap the MOVE within a FUNCTION or PROGRAM POU, the Output variable of the POU is disturbed even when the EN pin is FALSE. For a FUNCTION POU (Example 1) the output variable will be set to zero. For a PROGRAM POU (Example 2) the output variable will be set to the last output value when the EN pin was TRUE. Also, the ENO pin will be TRUE when the EN pin is FALSE.
We have situations were we want to run certain POUs conditionally, and only update the output variable(s) when THE EN pin is TRUE. The logic inside those POUs is more substantial than just a MOVE, but we use a MOVE to illustrate this issue.
As of right now our logic won't work properly because even when the EN pin is FALSE, output variables are modified.
We are looking at IEC 61131-3 but don't see where this situation is explicitly covered, but are still studying the reference we have (Heinz & Tiegelkamp), Springer.
Any thoughts on this?
When reviewing the examples be sure to note variable values in the data table above the code. The values shown alongside the variables in the LD seem to be truncated by TwinCAT.
Example 3 is the gold standard. If we could get either of the other two Examples to work the same way, then we would be back in business.
Your comments on this are appreciated!
Thank you!
View attachment POU_Output_Variables_Example_1.pdf
View attachment POU_Output_Variables_Example_2.pdf
View attachment POU_Output_Variables_Example_3.pdf
Last edited: