Getting Started with PLCs: Begin Your Automation Programming Journey
On this page
Getting Started with PLCs: Begin Your Automation Programming Journey
A programmable logic controller (PLC) is a special-purpose computer that does not have the display, keyboard, printer and other peripherals of a traditional computer and is usually hidden in the equipment control panel. Initially, PLC was a substitute for relay panels and switchgear because the design of relay control circuits became difficult and maintenance costs were high as the equipment contr
Detail
PLC has two basic working modes: RUN and STOP. In the RUN mode, PLC realizes the control function by repeatedly executing the user program that reflects the control requirements. One cycle can be divided into five stages: internal processing, communication service, input processing, program execution and output processing. In the input processing stage, PLC reads the status of all external input circuits into the input image register; in the program execution stage, it performs logical operations and updates the component image register according to the instruction requirements; in the output processing stage, the status of the output image register is transmitted to the output latch to drive the external load to work.
The input interface of the PLC receives the signal of the controlled device and drives the internal circuit to connect or disconnect through the optocoupler and the input circuit. The output interface outputs the execution result of the program through the optocoupler and the output component to control the connection or disconnection of the external load. There are three types of PLC switch output interfaces: thyristor output type, transistor output type and relay output type, each with different characteristics. For example, the thyristor output type can generally only carry AC loads, with fast response speed and high action frequency; the transistor output type can generally only carry DC loads, with fast response speed and high action frequency; the relay output type can carry AC and DC loads, but the response time is long and the action frequency is low.
Start with basic electrical control components, such as common knife switches, combination switches, fuses, circuit breakers, push button switches, AC contactors, thermal overload relays, intermediate relays, travel switches, time relays, etc. Understanding the structure and working principles of these components will help you better understand the logic control of PLC. For example, the letter symbol of the AC contactor is KM, and its contacts are divided into three parts: main contacts, auxiliary contacts, and coils. When the coil is energized, the main contacts and auxiliary contacts act at the same time to achieve control of the main circuit and control circuit.
Among PLC programming methods, empirical methods are highly favored, and data collection is particularly important in empirical design methods. First, we need to collect typical program samples, which should preferably include complete control tasks, I/O allocation, hardware wiring diagrams, complete programs and comments. For example, a program example for motor forward and reverse control clarifies that the control task is to realize the forward, reverse and stop of the motor. Through reasonable I/O allocation, such as connecting the start button to a specific input point and the motor to the corresponding output point, and with a detailed hardware wiring diagram, we can intuitively understand the actual connection method. The complete program contains logical judgment, timer setting, etc. and clear comments to help us understand the role of each step.
After reading the program, decompose it into components that complete different tasks. For subroutines or interrupt programs with specific functions, collect them in the program library in time. For example, in a complex production line control program, there may be a subroutine specifically used to detect faults. When an abnormal situation occurs, the subroutine is called for fault handling. We can collect such subroutines so that we can call them directly when we encounter similar control tasks in the future, saving program design time and improving the success rate of program debugging.
At the same time, record the highlights of the program, such as the programmer's clever ideas, program structure and the use of application instructions. Taking application instructions as an example, it can greatly shorten the program length, reduce memory capacity and reduce system costs. For example, in the data processing process, the use of specific application instructions can quickly implement functions such as data sorting and filtering.
Finally, design and debug the program for functional scalability, and record the whole process in detail and summarize it. Through this process, we can effectively digest these program examples, integrate them into our future programming, and gradually establish a programming method that suits us.
Sourcing help
Send the BOM for one quote covering active stock, EOL stock and cross-references.
Need a quote for this part?
Send us the part number or article link — we will confirm price, availability and lead time.