In the PLC ladder diagram program, we can group and name a set of rungs that's often used in the program. This's called sub program. It's similar to the sub program or function in any other computer programming language. Using the sub program could reduce the time and line number of any repeated rungs. It could also make the program more effective.
These instructions relate to the sub program.
- LABEL
- GOTO
- SUBPROG
- RETURN
- ENDSUB
- GOSUB
To make a sub program in the ladder diagram,
- Define SUBPROG name
- Add the rungs containing ladder diagram instructions that defines the sub program
- Define ENDSUB name
Look at this introductory example,
- A sub program (SUB1) display a counting value from 0 to F
- An input contact use to activate the CALLSUB instruction. When it's true, the sub program will activated.
![]() |
| sub program example |


No comments:
Post a Comment