Getting Started With PLC Programming

Chirag Panchal
9 min readJun 4, 2023

--

Generated using Thumbnail.ai

First, let me introduce you to Programmable Logic Controllers (PLCs). PLCs are industrial computers that play a crucial role in controlling and optimizing manufacturing processes. They are programmable controllers designed to automate various tasks and enhance operational efficiency in industrial settings. By leveraging their programmability, PLCs can be customized to meet the specific needs of a manufacturing process, making them an integral part of industrial automation.

History Of The Programmable Logic Controllers(PLCs):

Generated Using Thumbnail.ai

The history of Programmable Logic Controllers (PLCs) traces back to the introduction of the first PLC in 1965 by Richard Morley, often referred to as the “Father” of the Programmable Logic Controller. Morley’s creation, known as Modicon, derived its name from the “Modular Digital Controller.” The initial purpose of PLCs was to provide a viable alternative to the existing relay logic systems used in industrial automation.

The introduction of PLCs brought about a paradigm shift in industrial control systems. Unlike relay logic systems that relied on physical relays and hardwiring, PLCs offered programmability, reliability, and reusability. This new technology allowed for the replacement of cumbersome and labor-intensive relay control logic with flexible and easily modifiable software-based control.

The adoption of PLCs revolutionized industrial automation by streamlining processes and reducing costs. The benefits offered by PLCs, such as faster response times, increased precision, and enhanced troubleshooting capabilities, quickly made them the preferred choice in various industries. The cost savings achieved through the use of PLCs were so significant that relay-based systems became obsolete, except for a few specialized applications.

Over the years, PLCs have continued to evolve and advance. New technologies and innovations have made them more efficient, powerful, and user-friendly. Modern PLCs now incorporate features like networking capabilities, advanced programming languages, improved diagnostic tools, and remote access capabilities. These advancements have made it possible to control and monitor PLC systems from anywhere, enabling real-time data analysis, remote troubleshooting, and seamless integration with other automation systems.

Looking ahead, the future of PLCs appears promising. Emerging technologies, such as edge computing, cloud connectivity, and the Industrial Internet of Things (IIoT), are being integrated with PLC systems. These developments offer even greater possibilities for automation, data analytics, predictive maintenance, and overall system optimization.

In conclusion, the history of PLCs dates back to the introduction of the first PLC by Richard Morley in 1965. Since then, PLCs have revolutionized industrial automation, replacing relay logic systems with programmable, reliable, and reusable control solutions. The continuous advancements in PLC technology have paved the way for increased efficiency, ease of use, and integration with emerging technologies, shaping the future of industrial automation.

Why do we use PLCs and not computers?

While it’s true that PLCs do not possess the same capabilities as computers, there are several key reasons why they are preferred in industrial automation. Firstly, PLCs are designed to be highly reliable and robust, capable of operating under harsh conditions commonly found in industrial environments. They are built to withstand temperature variations, electrical noise, and vibrations that could potentially impact the performance of a regular computer.

Unlike computers, PLCs have a simplified architecture and do not require extensive resources or complex libraries to function. They are optimized for specific control tasks, making them efficient and straightforward to program. Additionally, the programming languages used in PLCs, such as ladder logic, are intuitive and user-friendly, enabling even non-programmers to understand and modify the logic.

One of the significant advantages of PLCs over computers is their stability. While computers are susceptible to crashes and software failures, PLCs are engineered to operate reliably for extended periods without interruptions. In the event of a failure, PLCs have built-in fail-safe mechanisms that ensure safe operation and prevent potentially hazardous situations. This level of reliability is crucial in industries where downtime or system failures can have severe consequences.

It’s important to note that PLCs are not infallible and can still experience failures. However, their design and purpose prioritize safety and dependable performance. Even in the rare case of a failure, PLCs are designed to fail in a controlled and safe manner, minimizing risks to personnel and equipment.

In summary, PLCs are specifically tailored for industrial automation, offering reliability, stability, and safety features that surpass those of traditional computers. While they may lack the extensive capabilities of computers, their specialized design and purpose make them the preferred choice for controlling manufacturing processes in a wide range of industries. fails in the safest possible way.

How does a PLC work?

Generated Using Thumbnail.ai

So as per the National Electrical Manufacturers Association (NEMA), a PLC is an electronic device that uses programmable memory to store the given instruction and to implement functions such as logic, sequence, timer, counters, and arithmetic operations to control machines and processes.

The PLC is a group of solid-state logic elements designed to make logical decisions and provide outputs.

PLC is a programmed interface between input sensors and output devices.

Created Using Draw.io

So The Whole PLC System can be divided into the following.

Central Processing Unit

Input Module

Output Module

Power Supply

Bus System

  1. Central Processing Unit (CPU): The brain of the whole PLC is the CPU Module. It consists of a microprocessor, memory chip, and other integrated circuits to control logic and communications.
  2. Input Module: This module serves as an interface between the real-time status of the process variable and the CPU.

There are two types of Input modules:

Analog input modules: In analog modules, inputs are 4–20 mA and 0–10 V

Digital input modules: For digital modules, inputs are 24 V DC, 115 V AC, and 230 V AC.

Examples: Selector switch, Limit switch, Push button, Through beam sensor, Inductive sensor.

3. Output Module: Output modules serve as a link between the CPU and devices in the field.

There are two types of Output modules:

Analog Output Modules: In analog modules, inputs are 4–20 mA and 0–10 V

Digital Output Modules: For digital modules, inputs are 24 V DC.

Examples: Valve, Lamp, Relay, Alarm, etc.

4. Power Supply: It provides the required voltage for the Input/Output Modules and CPU of the PLC. It also protects the solid-state devices from voltage spikes by providing isolation.

5. Bus System: It is the path for the communication of the signal between the CPU, Power supply, and Input/Output modules.

How Do you program a PLC?

Well, there are multiple ways to program a PLC, but the most commonly used method is through Ladder Logic. Ladder Logic is a programming language that was derived from relay logic panels, making it easy to understand and troubleshoot.

Allow me to provide you with an example of Ladder Logic Programming.

Created Using Studio 5000

As you can observe in the picture, the labels indicate “Input” and “Output.” These labels represent the connection points between the PLC and the real devices in the system, allowing for the exchange of real-time data. By manipulating the values assigned to these inputs and outputs, we can control and adjust the system according to our specific requirements.

Created Using Studio 5000

Now, if we direct our attention to the blue tags beneath the Input and Output labels, we can observe that they represent the addresses from the modules. These addresses need to be assigned and mapped according to the specific I/O connections before the programming stage. Each address is unique and corresponds to a specific input or output point.

By connecting the appropriate input address to its corresponding output address, we can individually control and activate specific devices or actions. This level of granularity allows us to operate multiple components or perform various tasks based on how the connections are established.

In essence, the mapping of addresses in the PLC programming ensures that each input is associated with its corresponding output, enabling precise control over the system’s functionality.

Created Using Studio 5000

In the visual representation, we can observe a simple logic that demonstrates how ladder logic works. When an input becomes active or receives a signal, the corresponding output is also turned on. This example serves to illustrate the basic principle of ladder logic programming.

To provide a deeper understanding, let’s consider a specific scenario. In this case, the input could be connected to a momentary or maintained button. When the button is pressed, it triggers a change in the input module’s value from 0 to 1. This signal is then transmitted to the output module, which undergoes a similar change in value from 0 to 1. The output module is connected to a real device in the field, such as a motor or a valve. As soon as the change in value occurs, the connected device reflects this change and initiates the intended operation.

In summary, this example showcases how ladder logic programming allows for the activation and control of output devices based on the state of the corresponding input signals. By establishing the necessary connections and configuring the logic, we can create a logical sequence of actions that drive the operation of machinery and equipment in real-world applications.

There are other ways to program the PLC as well

Here are some other ways as following :

1. Sequential Function Chart(SFC)

Example:

Created Using draw.io

2. Functional Block Diagram(FBD)

Example:

Image from Google

3. Structured Text(ST)

Example:

VAR
temperature: REAL;
threshold: REAL := 50.0;
output: BOOL;
END_VAR

IF temperature > threshold THEN
output := TRUE;
ELSE
output := FALSE;
END_IF

4. Instruction List(IL)

Example:

LD temperature
LD threshold
GT
ST output

Why choose PLCs and not Computers?

While it’s true that PLCs do not possess the same capabilities as computers, there are several key reasons why they are preferred in industrial automation. Firstly, PLCs are designed to be highly reliable and robust, capable of operating under harsh conditions commonly found in industrial environments. They are built to withstand temperature variations, electrical noise, and vibrations that could potentially impact the performance of a regular computer.

Unlike computers, PLCs have a simplified architecture and do not require extensive resources or complex libraries to function. They are optimized for specific control tasks, making them efficient and straightforward to program. Additionally, the programming languages used in PLCs, such as ladder logic, are intuitive and user-friendly, enabling even non-programmers to understand and modify the logic.

One of the significant advantages of PLCs over computers is their stability. While computers are susceptible to crashes and software failures, PLCs are engineered to operate reliably for extended periods without interruptions. In the event of a failure, PLCs have built-in fail-safe mechanisms that ensure safe operation and prevent potentially hazardous situations. This level of reliability is crucial in industries where downtime or system failures can have severe consequences.

It’s important to note that PLCs are not infallible and can still experience failures. However, their design and purpose prioritize safety and dependable performance. Even in the rare case of a failure, PLCs are designed to fail in a controlled and safe manner, minimizing risks to personnel and equipment.

In summary, PLCs are specifically tailored for industrial automation, offering reliability, stability, and safety features that surpass those of traditional computers. While they may lack the extensive capabilities of computers, their specialized design and purpose make them the preferred choice for controlling manufacturing processes in a wide range of industries.

Thank you,

Chirag Panchal

--

--

No responses yet