An understanding of PLC scanning is important to one’s understanding of PLC programming as a whole, no matter what platform you may be using. Generally, PLC programs are scanned from beginning to end. As logic for each rung and routine are solved, the status of bits and numerical registers is updated. At the end of the scan, outputs are updated, reflecting their new status.

How PLC Scanning Works

Nearly all PLCs (with the exception of one to our knowledge) handle scanning using the same process.

First, the CPU reads the physical inputs and writes them into a memory table, or “input table”. Next, the logic is processed rung by rung from left to right, then top to bottom within each routine, and the tables are updated. This process includes updating an output table, which is later used to drive the PLC’s physical devices.

The program might call different subroutines for different reasons throughout the scan. The order that these routines are called in may be important depending on where memory registers and output tables are updated. In most PLCs, the program scan always returns to its origin scan point, marking the end of the original cyclic routine. In Siemens, this initial cyclic routine is OB1; in Allen-Bradley’s SLC/Micrologix platform, it is LAD 2; in Allen-Bradley’s ControlLogix platform, it is simply called “Main Routine”.

Some programs do not use this continuous scanning process at all; instead, they use programs that run on a periodic basis. This is most common in process control applications.

How Long Does a PLC Scan Take?

The amount of time the scan takes depends on a number of factors, including the speed of the processor, how much code is in the program, and the types of instructions used. To make repetitive calls to the same routines, some programmers will make use of loops in the program, thus affecting the total scan time. Documentation is usually available to indicate the standard execution time for different instructions.

Scan times may vary from as short as 10-15 milliseconds to as long as 70-80 milliseconds for larger programs. If the scan time exceeds about 50 milliseconds for a machine control project, the effect on output reaction becomes noticeable so a more powerful processor is needed. For a process control project, this may not matter.

PLC scanning

A typical scan follows the process illustrated above: 1. Read inputs to a table; 2. Evaluate the logic; 3. Write output table to outputs.

Allen-Bradley’s ControlLogix platform is an exception to the scanning rules indicated by the process shown above. Instead of updating at the beginning and end of the scan, input and output registers are updated according to a time schedule known as “RPI”, or Requested Packet Interval. In the diagram above, the total scan time is 56ms, which is a fairly large program. The RPI is set to 20 milliseconds (see 20ms intervals in red above), which means that the program will receive two updates from the physical inputs and two updates to the physical outputs during a typical scan. Analog inputs and outputs, on the other hand, are usually set at a slower pace than digital, typically around 100ms or more. The updates occur at different points within the scan cycle, which can vary in duration quite a bit.