From the course: PLC Program Flow and Control Instructions

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Introduction to subroutines

Introduction to subroutines - Ladder Logic Tutorial

From the course: PLC Program Flow and Control Instructions

Start my 1-month free trial

Introduction to subroutines

- When you have a Long Ladder Logic Program, depending on the application, oftentimes, it's better to kind of chop the program into smaller pieces when applicable. The smaller pieces are called subroutines. A subroutine is a short program that is used by the main program to perform a specific function. The subroutines are called and executed from the main program, as you can see in the illustration here. Each subroutine must have a unique file number. This is how it works. When a subroutine is called from the main ladder logic program, the program is able to scape and go to a subroutine to perform certain functions and then, return to the main program. The main program is called the Main Routine. Sometimes a portion of the Ladder Logic Program must be repeated several times, during, for example, one machine cycle. The subroutine can save a great deal of duplicate programming. The sequence of rungs could be…

Contents