I have a problem with SFC. I'd like to jump to init step from a PLC task (for example when an error occurs),I can't use SFCInit as a global variable.
How can I do that? Could someone help me?
Thank you very much.
you could declare SFCInit within a class
in the declaration part of your SFC-POU.
Then you can access to it from another POU for example like this:
I hope this can help.
I try to make the same with Codesys V3 :
I have declared in my SFC properties the use of SFCinit (also in the menu Tool\options) but when I try to acces to mySFC.SFCInit form PLC_PRG , I have the message
"SFCInit" is no input of mySFC
I have try to declared :
in the declaration part my SFC POU, but it is the same.
Thank you very much
With my version 3.1 SP2 Patch 2 it works pretty fine. So the question ist what is your version?
My version is 3.1 SP3 Patch 1
Did you made just the declaration the use of SFCinit in the SFC properties (and also in the menu Tool\options)
or did you made the declaration explicit of
in the declaration part my SFC POU ?
You have to do both. Check the box for use and declare in element properties and declare the SFC-Flags you want to use as input.
By the way I was wrong My current version is 3.1 SP3 Patch 2 so it is one patch newer than yours.
I've tried again with the declaration & the validations in the properties but i still have the same message "SFCInit" is no input of mySFC.
What's wrong ? is there a correction in the Patch 2 ?
could you post a project archive? I'll have a look for it. Maybee i can see whats wrong.
In order to activate SFCInit for a SFC POU you must open the property window of SFC POU object (right button click over the POU name) and in the "SFC Configuration" tab click "Active" in SFCInit variable.
Also the declaration of input variable in the POU is needed:
SFCInit : BOOL ;
I see this post is so old, but I have a question regarding SFC Configuration flags.
I can create an SFC Pou and, for instance, add SFCInit:BOOL; to the declaration text. But in order to use it, I have to check SFCInit flag from SFC Configuration window.
So, is it possible to configure flags from a python script?
Accessing the 'Use' flags directly is not possible, but you can export the POUs to PLCOpenXML and edit the flags there before reimporting.
Thanks! That solves my problem.
If your question is about python scripting, then this thread is totally the wrong place 😉
Maybe you want to explain your problem in more detail in the "Engineering" forum.
But just in case, that I got your question right, here is a pointer:
simimar to read_value, you can do a write:
Yep, but I don't think I can do a write to an SFC configuration property. Thanks by the way.
Log in to post a comment.