Inst ToolsInst ToolsInst Tools
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Search
  • Books
  • Software
  • Projects
  • Process
  • Tools
  • Basics
  • Formula
  • Power Plant
  • Root Cause Analysis
  • Electrical Basics
  • Animation
  • Standards
  • 4-20 mA Course
  • Siemens PLC Course
Reading: How to use Sub Routines with Allen Bradley PLC
Share
Notification Show More
Font ResizerAa
Inst ToolsInst Tools
Font ResizerAa
  • Courses
  • Design
  • PLC
  • Interview
  • Control System
Search
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Inst Tools > Blog > PLC Tutorials > How to use Sub Routines with Allen Bradley PLC

How to use Sub Routines with Allen Bradley PLC

Last updated: March 4, 2021 3:48 pm
Editorial Staff
PLC Tutorials
No Comments
Share
3 Min Read
SHARE

Sub routines are sub programs in a PLC project. We can split the whole program by its function or sequence. We can call the sub programs from main page using instructions.

Contents
Sub Routines with Allen Bradley PLCPLC Instruction DescriptionJSR-Jump to Sub routineRET: Return to Main PagePLC ProgramProgram Description:

Sub Routines with Allen Bradley PLC

AB PLC Sub Routines

In the above picture, there are totally 8 files listed. In that SYS 0 and SYS 1 are default files.

  • LAD 2-Main is the main page of the program, that means PLC starts executing IO’s from this page only.
  • LAD-3-IO MAPPING, LAD 4-SCALING, LAD 5-PID, LAD 6-PLANT 1 and LAD 7 PLANT 2 are sub programs categorized by project function and sequence.

PLC Instruction Description

  1. JSR-Jump to Sub routine

JSR-Jump Instruction in Allen Bradley PLC

We can use this instruction using condition by adding some input before the instruction like,

JSR-Jump Instruction Ladder Logic

In the SBR File number, we should give the ladder number i.e. which sub routine we should call at this place as shown in below figure.

Jump Instruction Address in PLC
  1. RET: Return to Main Page

RET Instruction in Allen Bradley PLC

Return instruction should add at the end of the sub routine program.

Return instruction AB PLC Logic

PLC Program

In this program, Sub routine instructions are explained using simple example.

 LAD 2-MAIN PAGE:

Allen Bradley PLC Example with Sub routines

LAD 3–IO MAPPING

AB PLC IO Mapping Logic

Note: Since its for example, LAD 4, LAD 5,LAD 6,LAD 7 pages are not included in this program

Program Description:

Case 1 :

If Sw2 is not turned on, In LAD 3-IO Mapping, no operations will be happen.

LAD 2-MAIN PAGE:

Ladder Logic example for JSR Instruction

LAD 3–IO MAPPING:

Even though, sw6 is turned ON, Move block is not doing any operation because in main page, JSR instruction is not activated

Move block in PLC

Case 2 :

If Sw2 is turned on, In LAD 3-IO Mapping, operations will be happen.

LAD 2-MAIN PAGE:

AB PLC Logic Mapping

LAD 3–IO MAPPING:

sw6 is turned ON, Move block is doing it s operation because in main page, JSR instruction is activated

AB PLC Example Ladder

Conclusion:

The above explained concept for subroutine is for example only. We can use this example program to understand the working of JSR and RET function in AB PLC ladder logic programming.

Author : Hema Sundaresan

If you liked this article, then please subscribe to our YouTube Channel for PLC and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

Read Next:

Allen Bradley PLC Subroutines

PLC Training Software Download

Allen Bradley Interview Questions

RSLogix 5000 PLC Programming

PLC Car Parking Ladder Logic

Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
You've successfully subscribed !

Continue Reading

How to Configure IP Address in Rockwell PLC?
How a 4-20mA Transmitter Works?
#9 PLC Best Practices – Validate indirections
What is Profinet and How to Configure in Siemens PLC?
MCQ on PLC (Programmable Logic Controller)
Hardwired I/O and Serial I/O – Differences Explained
Share This Article
Facebook Whatsapp Whatsapp LinkedIn Copy Link
Share
Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

128.3kFollowersLike
69.1kFollowersFollow
210kSubscribersSubscribe
38kFollowersFollow

Categories

Explore More

Simulation of Studio 5000 and FactoryTalk View Studio
What are Analog Inputs? – Analog Signals Processing in PLC
Pause the Timer PLC Ladder Logic
Types of PLC
Omron PLC Logic for Washing Machine Automation
Concept of DCS in Industrial Automation
Step by Step Guidelines for Downloading Free PLC software
PLC Sizes and Applications

Keep Learning

TP Timer in CodeSys

Timers in Codesys – Timer ON, Timer OFF, Pulse Timer

Siemens PLC

#20 PLC Best Practices – Identify Critical Alerts

Failsafe interlock Design

Failsafe Wiring Practices

Comparison of Proportional Integral Derivative Controllers (PID)

Comparison of Proportional Integral Derivative Controllers (PID)

PLC Program for Blinking Lamp on 5 Seconds Interval

PLC Program for Blinking Lamp on 5 Seconds Interval

Conveyor and Puncher PLC Program

Toggle Switch & Sensor: Conveyor and Puncher PLC Program

How to set password in Siemens HMI

How to Password Protect HMI in Siemens TIA Portal?

How to Design a Motor Faceplate in Graphics - SCADA Tutorials

How to Design a Motor Faceplate in Graphics? – SCADA Tutorials

Learn More

Extended Timer Logic in PLC

Extended Timer Logic in PLC

DTMF Based Project Topics and Ideas

Top 100 DTMF Based Projects, Topics and Ideas

old Pressure Switches

Pressure Switch Frozen Screwed Cover Extends the Plant Shutdown

RF Admittance Level Transmitter Working Principle

RF Admittance Level Transmitter Working Principle

Tree (chicken foot) topology

Fieldbus Device Capability

Design Process Control & Safety Systems

Design View of Supplying Process Control and Safety Systems

Top 100 LabVIEW Projects for Engineering Students

Top 100 LabVIEW Projects for Engineering Students

CPU Communication Ports in Siemens PLC

Types of CPU Communication Ports in Siemens PLC

Menu

  • About
  • Privacy Policy
  • Copyright

Quick Links

  • Learn PLC
  • Helping Hand
  • Part Time Job

YouTube Subscribe

Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?