FUnction Block calling in ST

xwalter
2010-04-04
2010-04-04
  • xwalter - 2010-04-04

    hi to everybody .

    I would like to understand the following thing , i have a simple program i'm starting just now with the fantastic codesys .

    In my program i have :

    1) Main -Prg ----> Structured text

    2) FB1 ----> Structured text

    The FB1 is simple , it only has 2 input parameter declared in its table

    ADD1-----INT

    ADD2-----INT

    and 1 output parameter

    SUM ------INT

    Difficult to understand that this FB get 2 integer numebers and calculate the sum and return it at output parameter .

    Up to now doesn't matter .

    In the Main-Prg i want to call this FB1 .

    So i write

    FB1(ADD1:=2,ADD2:=2,SUM=>myINT) ; //myINT is declared in the table as VAR .

    In the VAR table of Main-Prg i declare also the instance for FB1 as follow:

    DB_FB1 ---- FB1 .

    I compile all but an event occours .

    Normally , in the SCL (ST in simatic system) , when i call an FBxx i write

    dot "name of instance like this ----- FB1.DB_FB1(........,....,,....);

    But codesys doesn't like of course.

    If i use an other language in Main-Prg it's so easy to write the instance over the box , but in ST i don't understand what to do ....

    Can somebody tell me the right solution ?

    Thanks so much

    Walter

     
  • xwalter - 2010-04-04

    ok i have discovered

    To call the FB in ST it need to use the name of the instance and then pass the parameters

     

Log in to post a comment.