June 6, 2018

Controlling of conveyors with interlock

PLC Program: Conveyor Sequence Control and Interlocking

Problem Description

feeder drops material onto Conveyor 1, which then transfers the material to Conveyor 2 for further processing. The system must function automatically—conveyors should start based on material detection using load cells. The system must ensure sequence control and interlocking to avoid collisions.


https://plcscadaacademy.blogspot.com/


System Components and Setup

  • PLC Type: Siemens S7-300

  • Software: TIA Portal

  • Material Detection: Load Cells (preferred over proximity or limit switches for higher reliability)

I/O List

Inputs

AddressDescription
I0.0START Push Button
I0.1STOP Push Button
I0.2Load Cell 1 (Conveyor 1)
I0.3Load Cell 2 (Conveyor 2)

Outputs

AddressDescription
Q0.0Cycle ON Indicator
Q0.1Conveyor 1 Motor
Q0.2Conveyor 2 Motor
Q0.3Feeder Motor

Ladder Logic Program Description

Network 1: System Start Logic

  • When START (I0.0) is pressed and system is not in STOP mode (I0.1 not active), Cycle ON (Q0.0) is latched to keep the system running.

  • This also starts the Feeder Motor (Q0.3) to begin dropping material.

Network 2: Conveyor 1 Activation

  • If Cycle ON (Q0.0) is active and Load Cell 1 (I0.2) detects material, then Conveyor 1 Motor (Q0.1) turns ON.

Network 3: Conveyor 2 Activation

  • When Load Cell 2 (I0.3) detects material (i.e., material has transferred from Conveyor 1 to Conveyor 2), then Conveyor 2 Motor (Q0.2) turns ON.

Network 4: Emergency Stop Logic

  • If STOP Button (I0.1) is pressed, all outputs are turned OFF by resetting the Cycle ON (Q0.0) latch.

Functional Sequence (Interlocking Logic)

  1. START Button Pressed (I0.0 = 1):

    • Q0.0 (Cycle ON) = 1

    • Q0.3 (Feeder Motor) = 1

  2. Material Detected on Conveyor 1 (I0.2 = 1):

    • Q0.1 (Conveyor 1 Motor) = 1

  3. Material Transferred to Conveyor 2 (I0.3 = 1):

    • Q0.2 (Conveyor 2 Motor) = 1

  4. STOP Button Pressed (I0.1 = 1):

    • All outputs reset (Q0.0–Q0.3 = 0)

Runtime Test Cases

InputsOutputsPhysical Behavior
I0.0 = 1Q0.0 = 1Cycle ON Lamp turns ON
I0.2 = 1Q0.1 = 1Conveyor 1 Motor starts
I0.3 = 1Q0.2 = 1Conveyor 2 Motor starts
I0.1 = 1All Q outputs = 0System stops

Conclusion

This PLC program ensures automatic sequencing and interlocking of conveyor belts using load cell feedback. It minimizes manual intervention, improves reliability, and provides a robust material handling solution using Siemens S7-300 and TIA Portal.

Would you like me to also draw the ladder diagram or generate an image of the conveyor setup for better






 

June 2, 2018

Explanation of Motor Speed Initialisation Logic (Using First Scan Cycle, Initialisation Button, and Display Input)

Explanation of Motor Speed Initialisation Logic (Using First Scan Cycle, Initialisation Button, and Display Input)

This program controls how the motor speed value (MW10) is initialized and updated during PLC operation. It uses two special inputs—First Scan Cycle (I0.0) and Initialization Button (I0.1)—to determine when the system should load a default motor speed value. Under normal operation, motor speed is taken from the operator display (MW8).

Inputs and Memory Words Used

Signal / MemoryDescription
I0.0First Scan Cycle input (activates only once when PLC transitions to RUN mode)
I0.1Initialization push-button (allows operator to reset motor speed)
MW8Motor speed value coming from HMI or display
MW10Final Motor Speed Word used by the PLC to control the motor




Ladder diagram for the first scan cycle.

https://plcscadaacademy.blogspot.com/
https://plcscadaacademy.blogspot.com/

















  



FBD diagram for the first scan cycle.

https://plcscadaacademy.blogspot.com/

https://plcscadaacademy.blogspot.com/






Program Description

The main function of this program is to determine what value should be written into MW10 (Motor Speed) under different conditions:

A. Initialization Conditions (I0.0 or I0.1 active)

  • If the First Scan Cycle (I0.0) turns ON
    OR

  • If the Initialization Button (I0.1) is pressed

→ The PLC will load a default motor speed value of 10 into MW10.

This ensures that:

  1. On PLC startup, the motor always begins with a known safe speed.

  2. On operator demand, the motor speed can be reset to the same safe/default value.

B. Normal Operation (None of the initialization conditions active)

When neither I0.0 nor I0.1 is TRUE:

→ The motor speed is read from MW8 (HMI/Display Input) and written to MW10.

This allows the operator to modify motor speed from the HMI during normal running conditions.

Why This Logic Is Important

✔ Prevents unpredictable motor start-up values
✔ Ensures safety by assigning a known speed after startup or reset
✔ Allows operator control during normal running conditions
✔ Provides priority for first scan and reset operations

Final Explanation (Compact Version for Documentation)

This program ensures that MW10 (Motor Speed) is properly initialized and updated. During PLC startup or when the initialization button is pressed, the value 10 is moved into MW10. This sets a safe, predefined motor speed. If neither I0.0 nor I0.1 is active, the motor speed is taken from the operator display (MW8) and written into MW10. Thus, the logic provides automatic startup initialization and operator-controlled speed during normal operation.



May 28, 2018

Cyclical Program Execution

Cyclical Program Execution 

In a Programmable Logic Controller (PLC), the logic written by the programmer does not run randomly or continuously by itself. Instead, the PLC follows a repetitive, continuous cycle known as the scan cycle or cyclical program execution. This cycle ensures that all input signals are read, processed by the logic, and the appropriate outputs are updated in a predictable and deterministic manner.

This concept is fundamental to understanding how PLCs behave and how control logic executes in real-time industrial systems.




What Is Cyclical Program Execution?

Cyclical program execution refers to the method by which a PLC constantly repeats a sequence of operations. The PLC reads all input values, executes the program, updates output signals, performs system tasks, and then starts again—continuously and cyclically.

This loop happens very fast, usually in milliseconds, ensuring the system responds to changes almost instantly.


The PLC Scan Cycle (Step-by-Step)

A standard PLC scan cycle consists of the following stages:

Step 1: Input Scan (Reading Inputs)

  • The PLC reads the status of all input devices connected to digital or analog input modules.

  • These include:

    • Sensors (proximity, limit switches, photoelectric)

    • Push-buttons (Start/Stop)

    • Analog sensors (temperature, pressure, flow)

  • Input values are stored in a memory area called the Input Image Table (or simply Input Memory).

Key point:
PLC uses the stored input memory during the entire scan, not the real-time input state—inputs are locked in for that cycle.


Step 2: Program Execution (Logic Scan)

  • The PLC executes the user program line-by-line, rung-by-rung.

  • It uses the input values stored during the input scan.

  • Instructions such as:

    • Contacts (XIC, XIO)

    • Coils (OTE)

    • Timers, counters, comparison

    • Mathematical and logical operations

  • The results of the logic execution are stored in the Output Image Table (output memory), not directly written to the physical outputs yet.

Key point:
Outputs during execution are still virtual—they are not actuated until the next stage.

Step 3: Output Scan (Updating Physical Outputs)

  • After executing the logic, the PLC updates the actual physical output modules.

  • Output devices include:

    • Motors

    • Valves

    • Relays

    • Indicators

  • The PLC writes the values from the Output Image Table to the output terminals.

Key point:
Only after this step do real devices respond to logic changes.

Step 4: Housekeeping and Communication Tasks

The PLC performs internal tasks such as:

  • Diagnostics (checking module or CPU faults)

  • Communication with HMI, SCADA, PCs

  • Updating internal clock

  • Memory management

  • Background tasks, interruptions, high-priority operations

After completing these tasks, the PLC returns to Step 1 and repeats the cycle.

Why Cyclical Execution Is Important

✔️ Predictability and Determinism

Industrial systems need predictable timing. The scan cycle ensures consistent system behavior.

✔️ Fast Response

Scan times are typically 1–10 ms, ensuring real-time response.

✔️ Simplified Programming

Engineers can assume that logic executes in a consistent loop.

✔️ Reliable Automation

Input → Logic → Output happens in the same order for every scan, ensuring stable and safe operation.

Example of Cyclical Execution (Motor Control)

Consider a Start push-button (I0.0) and Motor (Q0.0):

  1. Input Scan:
    PLC reads Start = 1 (pressed).

  2. Logic Execution:
    Rung evaluates true → Motor coil (Q0.0) = 1.

  3. Output Scan:
    Motor output physically turns ON.

  4. Housekeeping:
    Communications with HMI updated, etc.

Next scan begins; even if Start is released, the latch holds Q0.0.

Factors Affecting Scan Time

  • Program size (number of rungs, function blocks)

  • Number of instructions (math, PID, communication-heavy)

  • Amount of I/O

  • Communication load (Modbus, EtherNet/IP, HMI, SCADA)

  • CPU performance of the PLC

Scan time can be viewed in diagnostics tools in PLC software such as CCW.

Special Cases: Interrupts & Immediate Instructions

While PLCs normally follow cyclical scanning, some operations break this rule:

Immediate Input/Output Instructions

  • Read/write physical I/O directly, bypassing scan tables.

Interrupt Routines

  • Triggered by events such as:

    • High-speed counters

    • Communication triggers

    • Timed interrupts

  • Run outside the normal cyclic scan.

These ensure high-speed or time-critical operations.

Summary

Cyclical program execution is the core method by which PLCs operate. Each scan cycle includes:

  1. Input Scan – Read inputs

  2. Program Execution – Execute logic

  3. Output Scan – Update outputs

  4. Housekeeping – System tasks

This predictable, repetitive cycle makes PLC-based automation stable, reliable, and responsive.