Dear Reader,
Welcome to our series on Ladder Logic (LAD) for Programmable Logic Controllers (PLC). LAD is a simple yet powerful way to program machines that are used in factories and many other places.
Our goal with these articles is to help you understand both the basic ideas and how to use LAD in real situations. We're working with Factory IO, a tool that lets us show how machines work using simulations. This means you'll see examples that make it easier to understand how to use LAD for different tasks. Step by step, we'll look at different ways to use LAD, so you can see how it works in action.
If you're new to this, don't worry. Learning to program with LAD might seem hard at first, but it gets easier the more you try, especially when you have good examples to follow. We're here to help guide you from the very basics to more advanced stuff. We'll start with something simple: a project that involves a conveyor belt. This is a great place to begin if you're new to programming.
I invite you to join me on this journey through the world of PLC programming in the ladder logic language LAD. Together, we'll discover how just a few lines of code can control the world.
Are you ready to begin this adventure? Prepare yourself for a series of articles that will open new perspectives for you in the field of industrial automation.
Let's start with the simplest scenario...
| Variable name | Type | Address |
| xPushButtonStart | Bool | %I0.0 |
| xPushButtonStop | Bool | %I0.1 |
| xConveyorEnable | Bool | %Q0.0 |
Scenario #1: A button turns on the conveyor 🤓
The first rung, Network 1, showcases an input component represented by a normally open (NO) contact labeled "%I0.0 'xPushButton Start'", which correlates to a green 'start' button in the Factory IO simulation.
Upon actuation, this green 'start' button triggers the corresponding output on the same rung, denoted as "%Q0.0 'xConveyor Enable'". This output is designed to activate or enable the conveyor belt within the Factory IO simulation, setting it into motion.
The ladder logic's straightforward flow shows an immediate response from the conveyor system as soon as the green 'start' button is pressed. There are no intermediary steps or conditions presented between the input and the output, which illustrates a direct control relationship between the start button and the conveyor's operation.
Scenario #2: A Latching Circuit 😃
Network 1 includes a single input contact labeled "%I0.0 'xPushButton Start'", connected in series with an output coil labeled "%Q0.0 'xConveyor Enable'".
The input "%I0.0 'xPushButton Start'" is designed to represent a green 'start' pushbutton in the Factory IO simulation. When this button is pressed, it closes the contact in the ladder diagram, allowing current to flow to the output coil. The output coil "%Q0.0 'xConveyor Enable'" then activates the conveyor belt within the simulation.
In a latching circuit, this output coil could be used to maintain the conveyor belt's motion even after the start button is released. To achieve this, "%Q0.0 'xConveyor Enable'" would be connected in parallel to the "%I0.0 'xPushButton Start'" contact. This means that once the start button is pushed and the output coil "%Q0.0 'xConveyor Enable'" is energized, it will continue to allow current to flow, latching the circuit in the 'on' position and keeping the conveyor belt moving until another condition or input breaks the circuit. This setup is common in PLC programming to maintain states in industrial controls.
Scenario #3: A Start-Stop system with a Start Button and a Stop Button 😃
In Network 1, there are two inputs: "%I0.0 'xPushButton Start'" and "%I0.1 'xPushButton Stop'", along with an output coil "%Q0.0 'xConveyor Enable'". The 'Start' pushbutton, when pressed in the Factory IO simulation, energizes the output coil and initiates the conveyor belt's operation.
After the 'Start' button input, there is a parallel connection to the output coil which creates a holding circuit. This means that once the 'Start' button is pressed and the coil is energized, the conveyor belt will continue to operate even after the button is released.
The 'Stop' pushbutton is connected as a normally closed (NC) contact in the physical world, which means it sends a TRUE signal when it is not pressed. However, in the ladder diagram, it is represented as a normally open (NO) contact. This is because in the logic of the diagram, the contact appears closed when the 'Stop' button is not pressed, allowing the holding circuit to keep the conveyor belt running. When the 'Stop' button is pressed, it "opens" this NO contact in the ladder logic, which actually cuts off the latching circuit, causing the output coil to de-energize and the conveyor belt to stop.
Scenario #4: A Start-Stop system with a Start Button and a Stop Button 😃 - with an SR Flip-Flop
The PLC ladder diagram in the image includes an SR (Set-Reset) flip-flop logic control block, which is employed to maintain the state of an output based on the states of two input commands.
The first input "%I0.0 'xPushButton Start'" is associated with the set command of the flip-flop. In a practical scenario, such as a Factory IO simulation, pressing this button would send a signal to set the flip-flop, thus energizing the output coil "%Q0.0 'xConveyor Enable'" and turning on the conveyor.
The second input "%I0.1 'xPushButton Stop'" is connected to the reset command of the flip-flop. This input is typically represented in the physical world as a normally closed (NC) button, which conducts when not pressed and breaks the circuit when pressed. In ladder logic, it's depicted as a normally closed contact, so when the 'Stop' button is pressed, it sends a reset signal to the flip-flop, which de-energizes the output coil "%Q0.0 'xConveyor Enable'", stopping the conveyor.
The SR flip-flop's output is connected to the coil controlling the conveyor, ensuring that once activated by the start button, the conveyor remains on until the stop button is pressed. This setup is advantageous for applications where a process must continue without holding the start button down and should only stop when a stop command is given, providing a secure control method for starting and stopping machinery.
Scenario #5: Approach to a Sensor 😃
The first input "%I0.0 'xPushButton Start'" is wired to the 'Set' (S) input of the flip-flop. In a simulation like Factory IO, activating this button sends a signal that sets the flip-flop, thereby energizing the output coil "%Q0.0 'xConveyor Enable'" to start the conveyor belt.
When the 'Stop' pushbutton "%I0.1 'xPushButton Stop'" is engaged or the sensor %I0.2 'xSensor' detects an object (since it's NC, it sends a TRUE signal when the sensor's path is clear), either condition will reset the flip-flop, which turns off the output coil "%Q0.0 'xConveyor Enable'", stopping the conveyor.
Scenario #6: Counting Boxes on the Conveyor
A natural next step for this PLC conveyor program is to count products. Add a CTU (count up) counter in a new network: the sensor xSensor drives the CU input, so every box that passes increments the counter. Use the counter output Q (reached when CV is equal to or greater than PV) to stop the conveyor after a batch, for example 10 boxes, and connect a Reset button to the R input to start a new batch. Because the sensor in Factory IO is NC, use a rising edge on the inverted signal (or a negated contact followed by a P_TRIG / R_TRIG) so that one box is counted only once. You will find a detailed description of CTU, CTD and CTUD in our article about counters in TIA Portal.
How to Design a PLC Conveyor Program Step by Step
Whether you are an engineer commissioning a real line or a student working in a simulator, every conveyor control program follows the same basic structure:
- Define the requirements. What starts and stops the belt? Is there a sensor at the end? Should the conveyor run in one direction or reverse? What happens after a power failure?
- Create the I/O list. List every push button, sensor and motor output with a symbolic name and address, just like the tag table at the beginning of this article (%I0.0, %I0.1, %Q0.0).
- Write the basic motor control. Start with a start/stop latch or an SR flip-flop, exactly as in scenarios #3 and #4.
- Add the sequence logic. Sensors, counters and timers decide when the belt stops, waits or hands the product over to the next zone.
- Test in a simulator first. Factory IO with PLCSIM lets you test the ladder logic without hardware; only then download the program to a real Siemens PLC.
Remember that the emergency stop of a real conveyor must not rely only on the PLC program. It is wired in a hardwired safety circuit (or handled by a safety relay or a safety PLC), and the standard program only reacts to its status.
Multi-Conveyor Lines and Zones
Real installations rarely have just one belt. On a line with several conveyors, each zone has its own motor output and a sensor at the end of the zone. A typical rule is: a zone moves only when it has a product and the next zone is free. Conveyors are usually started in sequence from the last one to the first, often with a short timer delay between motors, so that products do not pile up and the motors do not all start at the same moment. When the conveyor motors are driven by frequency inverters, the PLC program also sets speeds and reads drive status, but the start/stop and interlock logic stays the same.
The same program can be written on other platforms. In Allen Bradley Studio 5000 the instructions have different names - XIC (examine if closed) for a normally open contact, XIO (examine if open) for a normally closed contact, OTE for a coil and OTL/OTU for set and reset - but the ladder logic of the conveyor is identical.
Why Is My PLC Conveyor Program Not Working?
If the belt does not move in the simulation, check these points before changing the program:
- The CPU in PLCSIM is in RUN mode and the latest program was downloaded.
- The tag addresses in TIA Portal match the I/O mapping in Factory IO (for example the start button really is %I0.0).
- The Stop button and the sensor are NC devices - they are TRUE when not pressed or not blocked, so check whether you used a normally open or normally closed contact.
- The coil %Q0.0 is not written in two different networks - the last network executed in the scan wins.
PLC Conveyor Program - FAQ
How does a PLC conveyor program work?
The PLC reads the push buttons and sensors connected to its inputs, executes the ladder logic from the top network to the bottom and sets the output that switches the motor contactor or inverter. This scan repeats continuously, every few milliseconds, so the conveyor reacts immediately to buttons and sensors.
Which software do I need to program a conveyor in ladder logic?
For Siemens PLCs you need TIA Portal (STEP 7) and, without hardware, the PLCSIM simulator. Factory IO adds a 3D conveyor scene with sensors and push buttons, so you can see how your program behaves. The same exercises can be done in CODESYS or in Allen Bradley Studio 5000.
What's next?
The next part of the series is ready: Water tank PID regulator - ladder logic basics in Siemens TIA Portal, where we move from bit logic to analog values and process control.
If you want to learn the whole ladder logic toolbox step by step, with Factory IO scenes and PLCSIM, check out our Siemens TIA Portal LAD/FBD course.
Allen-Bradley hardware used in our materials (Micro800 controllers, HMI panels and accessories) is supplied by our technology partner Elmark Automatyka, an authorized Rockwell Automation distributor.


