1

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.

  • I have further tested to find out that inputs to one variable used in two or more consecutive steps can lose the latter inputs. Still haven't figured out why, but this seems to happen regardless of what the condition of the transition is in between the steps. – Taehoon Kim Jan 14 '20 at 07:42
  • I would attach the project. It is very hard to say by the comment. – Sergey Romanov Jan 15 '20 at 07:01
  • Can you debug? does the only thing the initial step do is to set "A_Status:=0;"? Does it does it continuously or only on the falling edge of the step (when it goes into the next step)?? – mfabruno Jan 15 '20 at 07:48
  • both the start and end steps have A_Status := 0; as their p1(the entry). – Taehoon Kim Jan 17 '20 at 01:10

1 Answers1

0

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
pboedker
  • 523
  • 1
  • 3
  • 17