Reputation: 41
So I have a problem where in my SFC it jumps to an inital step but the commands written in the step would not register.
At the end of the SFC a step inputs 5 into A_Status(INT). The very next transition checks if the value of A_Status is 5. No problems so far, but after the transition when it jumps to the start of the SFC, where the first step is supposed to input 0 into A_Status, A_Status stays at 5.
The cycle time of my program is 100ms. I have tried slowing the cycle but it didn't work. What seems to be the problem here? Maybe the same variable used in such a sequence just doesn't work?
Reply would be greatly appreciated.
Upvotes: 2
Views: 236
Reputation: 533
You don't mention if you write the values during Entry/Exit or in the SFC step actions. But beware, that on some occasions code from a previous step can be executed later than code in the new step.
Here is a link that explains the call order and why sometimes parts of the code is executed twice: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/45035999420423563.html
I've had succes with adding the following code in all the actions to prevent this from happening.
IF STEP_NAME.x THEN // Only execute this while the step is active.
// Insert code here.
END_IF
Upvotes: 0