SFC Init

freedumz
2016-07-26
2016-07-26
  • freedumz - 2016-07-26

    Hi Everyone,

    I'm currently loosing my mind with the flag and specially with SFCInit
    I've tried a lot of things but nothing seems to work :S
    So I'm using SFC(Chemical) like a function block, and I'd like to go back to the init step when I press the reset button
    So what I've tried:

    VAR_INPUT
    SFCInit:BOOL;
    END_VAR

    In my SFC POU
    but when I'm trying to call it in another POU
    I used: PLC_MAIN.Chemical.SFCInit and I received the error message: C0037 Chemical is no Input of PLC_MAIN
    I tried too by selecting SFC Init (USE and Delcare one by one and the both) but nothing to do is not working
    But when my program is running, in my SFC chemical, I see the flag SFCInit and If I force it, my SFC is reseted (like it has to do)

    I've tried too the same thing than in the help of codesys 3, so declaring it as a global variable:
    VAR_GLOBAL
    SFCinit:Bool;
    END_VAR

    but it's not working :/

    So if someone has an idea of what I could do

    Many thanks in advance

     
  • r.evbatyrov - 2016-07-26

    Hi freedumz,

    I think you set the SFCInit not in a proper way.
    Since you Chemical POU is a function block you have to instantiate it:

    PROGRAM PLC_PRG
    VAR
    ch1 : Chemical;
    bDoInit : BOOL:
    END_VAR

    And now you set SFCInit frow outside using an instance
    ch1.SFCInit := bDoInit;
    ch1();

    That should work

    Regards,
    Roman

     

Log in to post a comment.