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: Example of Flip-Flop PLC Program for Lamps Application
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 > Example of Flip-Flop PLC Program for Lamps Application

Example of Flip-Flop PLC Program for Lamps Application

Learn the example of flip-flop PLC program for lamps application using the ladder logic to control the two outputs.

Last updated: April 29, 2024 6:03 am
Editorial Staff
PLC Tutorials
No Comments
Share
11 Min Read
SHARE

In general, to make a flip-flop lamp application, you can use transistors with the help of capacitors as a timer for ‘ON’ and ‘OFF’ actions.

Contents
Example of Flip-Flop PLC ProgramI/O AddressingProgramming of PLC CodeFlip-Flop PLC Program for Lamps Application

However, in devices that operate using a certain program, the Flip-Flop lamp application can be easily made just by utilizing the timer function as a timer.

If the microcontroller is used to make flip-flop light applications, it only utilizes the time lag or delay condition to turn ON and OFF of a lamp. In PLC we can take advantage of the Timer function and use ladder diagram language for the same application.

Example of Flip-Flop PLC Program

This Flip-Flop PLC program uses 3 Digital Input contacts (PB_START, PB_STOP, RESET), 2 Digital Output contacts (LAMP_1, LAMP_2), 2 Timers (TIMER_0, TIMER_1), 4 Bit Memory allocation contacts (IR_MASTER, IR_TIMER_0,IR_TIMER_1, IR_COUNTER), 4 Word Memory allocation areas (PV_COUNTER, SV_COUNTER, SV_TIMER_0, SV_TIMER_1).

When the PB_START (%I0.0) button is activated then the system will be started and will turn ON the Coil IR_MASTER (%M0), at the same time it will also activate TIMER_0 (%TM0) and Digital Output LAMP_1 (%Q0.0).

When TIMER_0 (%TM0) has reached its Preset value, it activates TIMER_1 (%TM1). The active Digital Output changes to LAMP_2 (%Q0.1) for a long time until TIMER_1 (%TM1) reaches its Preset value, while the Digital Output LAMP_1 (%Q0.0) turns OFF.

Digital Output LAMP_1 (%Q0.0) and LAMP_2 (%Q0.1) will light alternately several times according to the preset counter value that has been set. The actual value (PV_Counter) can be RESET and the Preset value (SV_COUNTER) can be varied.

Preset values of TIMER_0 (%TM0) and TIMER_1 (%TM1) can be set respectively. The system can only stop if PB_STOP(I0.1) and IR_COUNTER(%M3) are enabled.

I/O Addressing

The Input, Output, TIM, Bit Memory, and Word Memory addresses are shown below.

CommentInput (I)Output (Q)Bit MemoryWord MemoryTIMERS
PB_START%I0.0    
PB_STOP%I0.1    
RESET%I0.2    
LAMP_1 %Q0.0   
LAMP_2 %Q0.1   
TIMER_0    %TM0
TIMER_1    %TM1
IR_MASTER  %M0  
IR_TIMER_0  %M1  
IR_TIMER_1  %M2  
IR_COUNTER  %M3  
PV_COUNTER   %MW0 
SV_COUNTER   %MW1 
SV_TIMER_0   %MW2 
SV_TIMER_1   %MW3 

Programming of PLC Code

Initial Setup

Open Ecostruxure Machine-Basic Software, and enter the Configuration menu to set the type of PLC used, and Digital Input / Output contact settings to be used.

Choose PLC type PLC as needed, in this program, I use type TM221C24T. To change or add PLC we can click the type of PLC in the list column and then drag it to the work page as shown below.

TM221C24T Schneider PLC

Set Up Digital Input Contacts

To set the Digital Input contact parameters, we have to press the Digital Input sub-menu first, then a list of Digital Input contact address parameters will appear on the work page as shown below.

Select the number of contacts to use, then name the SYMBOL column (as shown in box no.4). This program uses 3 Digital Inputs with names/labels PB_START, PB_STOP, and RESET.

When finished, click the “Apply” button to apply the settings that have been done. In Ecostruxure Machine-Basic Software, the Digital Input address uses the format %I0.0 – %I0.xxx.

Digital Inputs Assignment in PLC

Set Up Digital Contact Output

Just like the method in setting Digital Input, we need to click the Digital Output Sub menu then a list of Digital Output parameters will appear on the work page.

Give a name/label to the SYMBOL column, in this program using 2 Digital Output contacts with names/labels LAMP_1, LAMP_2. We can also add a description of each address in the comment field.

When finished, click the “Apply” button to apply the settings that have been done. In Ecostruxure Machine-Basic Software, the Digital address output address uses the format %Q0.0 – %Q0.xxx.

Set Up Digital Contact Output

The next step is to enter the Programming Sub menu to create a Program. Create a Program as follows.

Flip-Flop PLC Program for Lamps Application

NETWORK 0

In this rung, there are 3 NO(Normally Open) contacts from PB_START (I0.0), IR_MASTER (%M0) and IR_TIMER_0 (%M1), 4 NC (Normally Close) contacts from PB_STOP (%I0.1), IR_COUNTER (%M3), and IR_TIMER_1 (%M2), 3 Bit Memory Coils IR_MASTER (%M0), IR_TIMER_0 (%M1), and IR_TIMER_1 (%M2).

When PB_START (I0.0) is activated momentarily, it turns ON the Bit Memory Coil IR_MASTER (%M0). At the same time, TIMER_0 (%TM0) will start calculating until it reaches its Preset value.

When TIMER_0 (%TM0) has reached its Preset value, it activates TIMER_1(%TM1) and turns ON the Bit Memory Coil IR_TIMER_0 (%M1). When TIMER_1 (%TM1) has reached its Preset value, it activates the Bit Memory Coil IR_TIMER_1 (%M2).

The Bit Memory Coil IR_TIMER_1 (%M2) will only activate for a moment and instantly cut OFF the incoming signal flow to the TIMER_0 (%TM0) using its NC (Normally Close) contacts.

The system will not stop if PB_START is turned OFF, the system will still run because of the Latching function of Bit Memory IR_MASTER (%M0). The system will stop only if PB_STOP (%I0.1) is enabled, and IR_COUNTER(%I0.2) is ON.

Flip-Flop PLC Program for Lamps Application
PLC Program – Rung 0 and 1

NETWORK 1

In Rung 1, there are 2 NO (Normally Open) contacts from IR_MASTER (%M0) and IR_TIMER_0 (%M1), 1 NC (Normally Close) contact from IR_TIMER_0 (%M1), 2 Digital Output Coils from LAMP_1 (%Q0.0) and LAMP_2 (%Q0.1).

When the NO (Normally Open) IR_MASTER (%M0) contact is active simultaneously it will also activate LAMP_1 (Q0.0), while LAMP_2 (%Q0.1) will be active when there is a change in the Bit Memory logic value IR_TIMER_0 (%M1) to “True”.

LAMP_1 (%Q0.0) and LAMP_2 (%Q0.1) will work interchangeably because they use the same Bit Memory address which is IR_TIMER_0 (%M1) but uses a different type of contact, LAMP_1 (%Q0.0) uses the NC (Normally Close) contact and LAMP_2 (%Q0.1) uses the NO (Normally Open) contact.

NETWORK 2

This rung serves as a counter area. There is 1 Rising Edge type NO (Normally Open) contact with Bit Memory address IR_TIMER_1 (%M2) and Operation Block with the function “%MW0:= %MW0+1”.

When the NO (Normally Open) contact of IR_TIMER_1 (M2) is active, the Operation Block will move data from PV_COUNTER (%MW0)+1 into the PV_COUNTER address  (%MW0), so that every NO (Normally Open) contact from IR_TIMER_1 (M2) is active, the data at the PV_COUNTER address (%MW0) will increase by 1.

This way the Rising Edge type NO (Normally Open) Contact works is that when the contact is activated, it will channel a signal of 1 pulse wave at the beginning of the button is activated and immediately turns OFF. Thus eliminating the possibility of the amount of data entering the PV_COUNTER (%MW0) more than 1 time.

Flip-flops in PLC programming
PLC Program – Rung 2, 3, 4, 5, and 6

NETWORK 3

In RUNG 3, there is 1 NO (Normally Open) contact from IR_MASTER (%M0), 1 Operation Block with %MW0>=%MW1 function, and 1 Coil IR_COUNTER (%M3).

The NO (Normally Open) contact of the activated IR_MASTER (%M0) will send a signal to the Coil IR_COUNTER(%M3) when the value at PV_COUNTER (%MW0) is greater than or equal to SV_COUNTER (%MW1).

SV_COUNTER (%MW1) serves as a comparison reference data from PV_COUNTER (%MW0) so that when the PV_COUNTER value (%MW0) is greater than or equal to SV_COUNTER (%MW1) it will turn ON the Coil IR_COUNTER (%M3) which causes the system to stop, because of the Interlock function of the IR_COUNTER( %M3) in RUNG 1.

SV_COUNTER (%MW1) also functions as Preset Counter data commonly called Set value, so we can enter data on the SV_COUNTER (%MW1) as we wish.

NETWORK 4

This rung serves to reset the Counter data in the PV_COUNTER (%MW0).

There is 1 NO (Normally Open) contact of RESET (I0.2) and 1 Operation Block with %MW0:=0 Function.

This means that for every contact NO (Normally Open) of RESET (I0.2) is active, the Operation Block will move the value “Zero” to PV_COUNTER (%MW0).

NETWORK 5

Rung 5 only has an Operation Block that functions as a preset value adjuster of TIMER_0 (%TM0).

When the data is entered into SV_TIMER_0 (%MW2) it will be moved into Preset data TIMER_0 (%TM0).

NETWORK 6

Rung 6 only has an Operation Block that functions as a preset value adjuster of the TIMER_1 (%TM1) value.

When the data is entered into SV_TIMER_1 (%MW3), it will be moved into Preset data TIMER_1 (%TIM1).

If you liked this article, 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:

  • Digital Electronics Objective Questions
  • How to Blink Lights in PLC Ladder Logic?
  • Electrical Ladder Diagram Control with Timers
  • PLC Control a Pump based on Level Sensors
  • Design flip-flop using other flip-flops Questions
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

Difference between Cold Standby and Hot Standby
Actuator Sensor Interface (ASi) Protocol in PLC
PLC Multiple Choice Questions
Applications of SCADA
Open Source PLC and SCADA Software
How to Work with Allen Bradley RsLogix Emulator?
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

What is 21 CFR in SCADA and HMI Systems?
Communication Processor Module in Siemens PLC
What is Hot Standby in PLC?
Up Counter PLC Program
Wiring in a PLC Control Panel
Difference between Signal Cables and Control Cables
All About Fieldbus Protocols
Draw a Ladder Logic to switch ON-OFF a Bulb using a Toggle Switch ?

Keep Learning

Siemens Tia Portal PLC Training Course

Siemens Tia Portal PLC Training Course

PLC offline data of a project are compared

Compare Two Offline PLC Projects

Omron PLC increment and decrement

Increment & Decrement Instructions in CX-Programmer (OMRON)

4-20mA Current Loop for Flow Transmitter and Control Valve Positioner

4–20 mA Process Control Loops

Historical Scada graph

Configuration of InTouch Scada Trends

Loop Diagram

Documentation and Change Control of PLC or DCS Systems

Statement List (STL) to Find Highest Value in the Data Block

Statement List (STL) to Find Highest Value

Comparison Instructions in PLC Programming

Comparison Instructions in PLC Programming

Learn More

Turbine Flow meter calibration

Turbine Flow Meter Calibration

How to Select a Rotameter? – Parameters and Applications

Design Counters in PLC Programming With a Move Instruction

Design Counters in PLC Programming With a Move Instruction

Control System Basic Wiring Practice Animation

PLC Connection between Instrument, Junction Box, Marshalling & System Cabinet

Rotary Encoder

Rotary Encoder Interview Questions and Answers

Side Mounting Float Switch Working Principle

Side Mounting Float Switch Working Principle

Electrical Machines Objective Questions

Electrical Machines MCQ Series 13

Falling Ball Viscometer Principle

Falling Ball Viscometer Principle

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?