Codesys LD: how to jump from a process to other process

312 views Asked by At

I am new to Codesys Ladder programming.  We are converting our Ladder application to Codesys LD. Our application has several processes. Each process handles different subjects. Each process is activated by a Jump To Subprocess element from another process. For example: MainProcess: Rung1: if Relay is Open->Jump to Process1; If Relay is closed - Jump to Process2 Process1{} Process2{}

I'm looking for a way to implement the same thing (jump from a process to a different process ) with Syscode LD. 

Thanks

1

There are 1 answers

0
Scott On

I would suggest creating methods for process1 and process2.

Then, you can simply have your relay NC rung call process1 method and your relay NO rung call process2 method.

MainProcess has sub objects:

Method Process1

Method Process2

Then you can do the following without any “jumping”

Relay |—-|/|—-Process1—-|

Relay |—-| |—-Process2—-|

You can also replace calls to sub process objects with calls to separate programs or methods of other programs:

Relay |—-|/|—-DifferentProg.Process—-|

Relay |—-| |—-AnotherProg.Process—-|

However, you can use the JUMP to label command to achieve what you ask (if your jump to is in the same program). The key is to add a label to the rung by clicking in the area in the upper left of the rung (there is a line for comment and a line for label). Check your LD options to make sure your editor shows those areas.

Just be sure to put a jump to end and make an end for this style otherwise process 1 will go right into process 2!