How do I call an action from ladder logic?

standeven
2015-04-27
2015-05-02
  • standeven - 2015-04-27

    Hello,

    I've created a function block with actions. In a seperate program written in ladder logic, I've created an instance of the function block. Now how do I specifically call that action on a rung?

    Thanks!

     
  • shooter - 2015-04-29

    so you made a function block and some actions in it.
    now you have a ladder program and you want it to run one of these actions.
    set the mouse on the rungline and click.
    Insert a FB, you will see a AND block appearing, press F2 and look for your action under user definned blocks. there is a small plus sign to find your action.m double click it and it will be in your program.
    give it a name and automatically it will be defined in the VAR list.
    every action needs to have a unique name in the var list even if same action is used more then once.

     
  • standeven - 2015-05-02

    Thanks shooter. This is the second time you've helped me

    Question though: why do I need to call it with a unique name? I tried calling it with the same name and the program functions as expected. You had mentioned on another post that it was hard to control in codesys when calling it this way, I'm just trying to understand why.

     
  • shooter - 2015-05-02

    if you call the same actionname twice you get the results from the previous one.
    you can try this by adding one to a local variable inside your action(well it is defined inside the function block).
    If you call it again you will see the number doubles.

     

Log in to post a comment.