PLC Program to Latch and Unlatch Output with Time Delay


This is a PLC Program to Latch and Unlatch Output With Time Delay.

Problem Description

Implement Latching and Unlatching of output with a particular time delay in PLC using Ladder Diagram.

Problem Solution
  • After solving previous problem, we know how to Latch and unlatch a coil.
  • Previous problem can be modified to solve this problem.
  • There are total three types of Timers available known as TON, TOFF and RTO timers.
  • TON -Timer On
  • TOFF -Timer Off
  • RTO -Retentive Timer On
  • TON timer is used here to solve this problem.
PLC Program

Here is PLC program to Latch and Unlatch Output With Time Delay, along with program explanation and run time test cases.

List of Inputs and Outputs
 I:1/0		= Start Push Button	(Input)
 T4:0/DN	= Timer 4.0 done bit	(Input)
 O:2/0		=			(Output)
 T4:0		=			(Timer)

Ladder Diagram to solve this problemplc-program-latch-unlatch-output-time-delay-01

Program Description
  • Latching is done the same way as in previous program. The only difference in this program is that Timer On is added to unlatch the output after 10secs. And to operate unlatching of output, instead of using stop PB, Timer On done bit passed to Stop XIO contact which operates automatically.
  • Time Delay to turn output off can be decided by operator in terms of Multiplication of Time Base and Preset. It means if time base is 0.1 and we want to generate 10secs of time delay then Preset value must be set to 100 so that “100 * 0.1 = 10secs”.
  • When input I:1/0 is pressed momentarily, output goes true and it is latched.
  • When output is latched, Timer T4:0 is enabled and EN bit goes high.
  • As long as O:2/0 is true, Timer T4:0 is active and accumulator value is incremented.
  • When Timer count (Accumulator value) is equal to Preset value, Timer Done Bit T4:0/DN goes high which works as a Stop PB of previous problem causing output to go false.
  • Important thing to note here is that when timer is ON and you press Start PB as soon as Time delay is over, output is latched again. So during those 10secs, Start PB has no effect on output at all.
Runtime Test Cases

During timer on conditionplc-program-latch-unlatch-output-time-delay-02
After 10secsplc-program-latch-unlatch-output-time-delay-03


Sanfoundry Global Education & Learning Series – PLC Algorithms.
To practice all PLC programs, here is complete set of 100+ PLC Problems and Solutions.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.