How Does the CPU Execute User Programs in an ABB PLC System?

2026-10-23

An automation engineer is commissioning a high-speed packaging line with an ABB PLC. The line uses a servo-driven flying shear and a registration sensor. The program runs correctly in simulation, but on the real machine the shear fires 12 milliseconds late. The engineer checks the program logic. It is correct. The engineer checks the servo drive. It is correctly configured. The problem is the scan cycle. The user program is 8 milliseconds long, but the flying shear interrupt is being delayed by a non-interruptible block of code that runs for 15 milliseconds. The CPU cannot respond to the high-speed input until the current scan is complete. The engineer restructures the program to move the non-critical code into a lower-priority task. The shear now fires within 1 millisecond of the target. This guide explains how the CPU executes user programs in an ABB PLC system and why the execution model matters for deterministic control.

ABB ACS850


1. What Is the Scan Cycle and How Does the CPU Execute It?

The CPU of an ABB PLC executes the user program in a repeating cycle called the scan cycle. The scan cycle has three phases: the input scan, the program execution, and the output update. During the input scan, the CPU reads the status of all input modules and stores the values in an internal memory area called the process image input. During the program execution, the CPU executes the user program instruction by instruction, using the process image values as the input data. During the output update, the CPU writes the results from the process image output to the physical output modules. The table below shows the scan cycle phases and their typical durations.

Scan phase Function Typical duration (AC500 PM583) Deterministic
Input scan Read input modules into process image 0.5 – 1.0 ms Yes
Program execution Execute user program instructions 5 – 20 ms (depends on program size) Mostly
Output update Write process image to output modules 0.5 – 1.0 ms Yes
Housekeeping Communication, diagnostics, memory management 1 – 3 ms No (varies)

In our factory, we supply ABB PLC systems to machine builders and process plants. The scan cycle time is a critical specification for high-speed applications. The AC500 PM583 CPU executes a 1,000-instruction program in approximately 0.1 milliseconds, which allows a scan cycle of 5 to 10 milliseconds for a typical machine control program. Yueyang Tongtu E-commerce Co., Ltd. provides scan time calculations for our customers.


2. How Do Different Instruction Types Affect Program Execution Time?

Not all instructions take the same amount of time to execute. The CPU executes some instructions in a single clock cycle, while others require multiple cycles. Boolean instructions, such as AND, OR, and NOT, are typically executed in one cycle. Data movement instructions, such as MOV, require two to four cycles. Floating-point math instructions require 10 to 50 cycles. Function block calls, such as PID controllers, require 50 to 200 cycles. The table below shows the typical execution time for common instruction types on an ABB PLC.

Instruction type Example Execution time (µs) Relative cost
Boolean AND, OR, NOT 0.01 – 0.02 1x
Integer math ADD, SUB, MUL 0.02 – 0.05 2 – 3x
Floating-point math ADD_R, MUL_R 0.10 – 0.30 10 – 15x
Data movement MOV, MOV_R 0.02 – 0.06 2 – 4x
Function block PID, ramp, filter 0.50 – 2.00 50 – 100x
Communication Modbus read/write 1.00 – 5.00 100 – 250x

Automation engineer's note: The program execution time is dominated by the most expensive instructions. A program with 1,000 Boolean instructions and 10 PID function blocks will spend most of its scan time in the PID blocks. In our factory, we recommend that the engineer estimate the scan time by multiplying the number of instructions by the execution time for each type. If the estimated scan time exceeds the application requirement, the engineer should optimize the program by reducing the number of function block calls, using integer math instead of floating-point math where possible, and moving non-critical code to a slower task.


3. How Do Interrupts and Task Priority Affect Determinism?

The standard scan cycle is not deterministic because the CPU may be interrupted by higher-priority tasks. ABB PLC systems support multiple tasks with different priority levels. A high-priority task, such as a motion control or high-speed counting task, can interrupt the main program and execute immediately. The main program resumes after the high-priority task is complete. The table below shows the task priority levels and their typical use cases.

Task type Priority Typical cycle time Use case
Cyclic task (main program) Low 10 – 50 ms General machine control, HMI updates
Cyclic task (fast) Medium 2 – 10 ms PID control, high-speed logic
Interrupt task (I/O) High Event-driven Registration, high-speed counting
Interrupt task (timer) High 1 – 5 ms Motion control, encoder feedback
System task Highest Background Communication, diagnostics

The interrupt latency is the time between the event and the start of the interrupt task. On an ABB PLC, the interrupt latency is typically 100 to 500 microseconds, depending on the CPU model and the current instruction. If the main program is executing a long function block, the interrupt may be delayed until the block is complete. In our factory, we recommend that the engineer keep the main program scan time below the required response time of the fastest interrupt task. Yueyang Tongtu E-commerce Co., Ltd. provides application support for task priority configuration.


4. How Can the Program Execution Be Optimized for Faster Scan Times?

The program execution time can be optimized in four ways. The first is to reduce the number of function block calls. Function blocks are the most expensive instructions. If a PID block is called every scan but the process only needs an update every 100 milliseconds, the block can be moved to a slower task. The second is to use integer math instead of floating-point math where precision is not critical. The third is to avoid unnecessary communication instructions in the main program. Communication should be handled by a separate task or by the system firmware. The fourth is to use the CPU's built-in diagnostics to measure the actual scan time and identify the most time-consuming blocks. The table below shows the optimization techniques and their typical impact.

Optimization technique Typical scan time reduction Trade-off
Move PID to slower task 20 – 40% Slower PID response
Replace floating-point with integer math 10 – 20% Reduced precision
Reduce communication in main program 15 – 30% None (communication handled separately)
Optimize program structure (fewer blocks) 10 – 25% Requires program refactoring

In our factory, we help customers optimize their ABB PLC programs for scan time. We provide a scan time analysis tool that runs on the PLC and reports the execution time for each program block. Yueyang Tongtu E-commerce Co., Ltd. offers training on program optimization and task configuration.


Frequently Asked Questions About CPU Program Execution in ABB PLC Systems

Question 1: What is the difference between the process image and the physical I/O?
Answer: The process image is a copy of the input and output values that is stored in the CPU's memory. During the input scan, the CPU reads the physical input modules and writes the values to the process image input. During the program execution, the user program reads from the process image input, not from the physical inputs. This ensures that the input values do not change during the program execution, which makes the program deterministic. During the output update, the CPU writes the process image output to the physical output modules. The physical I/O is the actual voltage or current at the terminals. The process image is the software representation. In our factory, we recommend that the engineer understand this distinction because it explains why an input change may not be seen by the program until the next scan cycle.
Question 2: How can I measure the actual scan time of my ABB PLC program?
Answer: The actual scan time can be measured in three ways. The first is to use the CPU's built-in system variables. Most ABB PLC CPUs provide a system variable that reports the current scan time in milliseconds. The second is to use a high-resolution timer in the program. The engineer can read the timer at the start and end of the scan and calculate the difference. The third is to use the programming software's online monitoring feature, which displays the scan time in real time. In our factory, we recommend using the built-in system variable for continuous monitoring and the high-resolution timer for detailed analysis. We also recommend logging the scan time over a 24-hour period to identify variations caused by communication or diagnostic tasks.
Question 3: What happens if the scan time exceeds the watchdog timer limit?
Answer: If the scan time exceeds the watchdog timer limit, the CPU detects a watchdog fault and stops the program. The outputs are set to a safe state, and the CPU enters a fault mode. The watchdog timer is a safety feature that prevents the CPU from being stuck in an infinite loop or a very long scan. The watchdog limit is typically 100 to 500 milliseconds, depending on the CPU model. In our factory, we recommend that the engineer set the watchdog limit to 2 to 3 times the normal scan time. If the watchdog fault occurs, the engineer should check the program for infinite loops, excessive function block calls, or communication timeouts. The fault log in the CPU will indicate the cause of the fault.

Summary for Automation Engineers

The CPU of an ABB PLC executes the user program in a repeating scan cycle: input scan, program execution, and output update. The scan time is determined by the number and type of instructions in the program. Function blocks and communication instructions are the most expensive. Interrupts and task priority allow the CPU to respond to high-speed events, but they introduce non-determinism if the main program is too long. By optimizing the program structure, moving non-critical code to slower tasks, and monitoring the scan time, engineers can achieve deterministic control for high-speed applications. Yueyang Tongtu E-commerce Co., Ltd. supplies ABB PLC systems and provides scan time analysis and program optimization support for our customers.

Yueyang Tongtu E-commerce Co., Ltd. supplies ABB PLC CPUs, I/O modules, and programming software. We provide scan time calculations, task priority configuration, and program optimization training for all of our products.

Need help optimizing the scan time of your ABB PLC program? Contact Yueyang Tongtu E-commerce Co., Ltd. for a free consultation. We will review your program structure and recommend the optimal task configuration.
Previous:No News
Next:No News

Leave Your Message

  • Click Refresh verification code