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

How to call another program from main ladder program?

Gaz
2014-03-13
2014-03-13
  • Gaz - 2014-03-13

    I have my main ladder program called PLC_PRG. I have created another program called Sub1 which is also in ladder.

    I wish to have it so that when say %MX0.0 is true then Sub1 is called. How do I so this?

     
  • shooter - 2014-03-13

    i gave you answer at plcs.net
    use a function block with enable (when you highlight the function (default is ADD) and press F2 you will find your program under user programs. (sometimes you need to press F11 before the list is updated)
    put your marker in the enable line as a contact
    you can also use the triggerup to do your sub1 only once depending on what purpose.

     
  • Gaz - 2014-03-13

    hello again shooter, yes you have and I have replied back with an error that I receive when doing what you said.

    "Error 4053: PLC_PRG (18): '???' must be a declared instance of function block 'HPA2'

     
  • shooter - 2014-03-13

    you are calling a function block
    it should be in the var list
    just start over again, and you will see that it will be done automatic.
    another way is to type in the varlist on top of ladder
    anyname prefer fhpa2:hpa2;

     

Log in to post a comment.