Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

SFC Init

YouMotion
2007-01-23
2021-08-06
  • YouMotion - 2007-01-23

    Dear Sirs,

    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.

    Roberto

     
  • RolandWagner

    RolandWagner - 2007-01-23

    Hi,

    you could declare SFCInit within a class

    VAR_INPUT

      SFCInit:BOOL;
    

    END_VAR

    in the declaration part of your SFC-POU.

    Then you can access to it from another POU for example like this:

    MySFC.SFCInit:=TRUE;

    I hope this can help.

     
  • bells - 2008-03-07

    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 :

    VAR_INPUT

    SFCInit:BOOL;

    END_VAR

    in the declaration part my SFC POU, but it is the same.

    Thank you very much

     
  • Ralph Holz - 2008-03-07

    With my version 3.1 SP2 Patch 2 it works pretty fine. So the question ist what is your version?

    Regards

    Ralph

     
  • bells - 2008-03-07

    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

    VAR_INPUT

    SFCInit:BOOL;

    END_VAR

    in the declaration part my SFC POU ?

    Regards

     
  • Ralph Holz - 2008-03-07

    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.

     
  • bells - 2008-03-07

    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 ?

    Regards

     
  • Ralph Holz - 2008-03-10

    Hi bells,

    could you post a project archive? I'll have a look for it. Maybee i can see whats wrong.

    Regards

    Ralph

     
  • SWilly - 2015-06-24

    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:

    VAR_INPUT
    SFCInit : BOOL ;
    END_VAR

     
  • maespinosa - 2021-08-04

    Hi all,
    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?

    Thanks!

     
  • Ingo

    Ingo - 2021-08-04

    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:
    https://forge.codesys.com/tol/scripting/snippets/14/

     
    • maespinosa - 2021-08-06

      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.