Jump to content

Recommended Posts

Posted (edited)
Hello, One thing that I constantly find hard to do when I program in SFC is to properly reset a FSM. If something goes wrong during the process I like to be able to reset the program. In Ladder this is quite simple to accomplish. Usually, I have a variable (non volatile) which is responsible for the step transition. If I want to reset the FSM I just use the function MOV to disable every step variable, which turn off the entire FSM. If I want to restart the program I use the MOV function again to enable only the first step. So my question is: how can we accomplish that in a SFC program? Lets not consider the option of having a reset transition in each step... Best regards, Paulo Edited by paulovedder
Posted

I suggest you to use integers to track the current and next states. I would also do the variables volatile.

If there is an error, you can just send the machine to whatever standby state you have.

If there is a power cut, the machine can initialize the state machine to whatever integer you want on the first scan (even with ladder, you can achieve that with a function block). Personally, I have a special initialization state that is triggered after the machine powers up and that loads the hardware configuration. In this way, I do not rely on persistent variables that could be lost if there is a power cut and the battery in the PLC is depleted.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...