Scan time of the PLC program

Now, that we know what hardware is inside the PLC, the next step will be to take a look at the software inside the PLC and how it runs. Every PLC has a scan time and a scan cycle. This is how the PLC and the software inside the PLC works. The scan cycle is the cycle of which the PLC gathers the inputs, runs your PLC program and then updates the outputs. This will take some amount of time often measured in milliseconds or ms. The amount of time it takes for the PLC to make one scan cycle is called the scan time of the PLC.

Beside the PLC hardware, the PLC contains some software. Some of it are pre-installed, and some of it will be your software.


PLC Firmware

First, let us divide the software inside the PLC into two parts. A little piece of software called the firmware and another piece of software called the program. The firmware is the operating system in the PLC. The firmware is responsible for running your program commands, managing communications and some other tasks. Some of the functions of the firmware is to make the microprocessor and the RAM communicate, and to make the PLC compatible with the PLC programming software. Many other tasks are handled by the firmware, and you will almost never have to worry about it. The firmware is installed by the manufacturer of the PLC.


Your PLC program

The other piece of software is actually the software that we develop for the PLC. It is the program of logic that we put inside the PLC. The program of logic that reads the inputs and sets the outputs. Before learning more about the program of logic we need to know is where in the PLC the program is placed.

Normally the program is saved in the RAM of the PLC, but as we know from the previous chapter the RAM can be a risky place to save your program. It can be risky because the RAM will be cleared when the power is off. Most PLC’s have a backup battery, that prevents the RAM from being deleted, but there is a better place to save your program more permanently – the EEPROM. The data in the EEPROM will still be there even after the power has been removed. So, the EEPROM is in most cases the optimal place for the program.


The scan time is how the PLC program works

The program of logic that we save into the PLC is the main function of the PLC. Your PLC program will decide what outputs to set with the inputs as decisions. When the PLC is powered up it will run as following:


PLC scan time of a PLC program


First thing the PLC will do is to check the status of all the inputs. To be more precise, the PLC will take an image of all the inputs and save it in the RAM. Where taking an image means that the PLC will save a binary value representing the inputs. Let me explain that in detail with an example:

Let’s say we have a PLC with 8 digital inputs. When the PLC checks the input status of all the inputs when they are all low, the binary number will be 00000000. Each 0 is a representation of a digital input. If the input is low the value will be 0, and if the input is high the value will be 1. So if we connected the last input (input 8) to a power source the PLC would save the number 00000001, when checking the input status.

After the PLC has checked the status of all its inputs, the PLC will then execute the program. The logic program that we program the PLC with will now run, and as it runs the program will collect some numbers and save them temporary. You might already have guessed what these numbers are. These numbers are the output status as the logic of the program have decided. When the program has ended the PLC will update the output status. The same thing now happens as with the inputs only in reverse. The number representing the output status will now be saved as the output status in the PLC, and the status of all the outputs will be updated.

What really happens is that the temporary number decided by the PLC program representing the output status will be a binary number just like the inputs. So let’s take an example of 8 digital outputs. The number saved by the program will be 00000000 if all outputs are to be updated to low or off. If the PLC program sets the first output to high the number saved will be 10000000. So with 0 as off and 1 as on.

So, how does the PLC update the outputs? The answer to that is a special place in the memory. At a special place in the memory the microprocessor will have a number that will always represent the status of the outputs. If we save the number 10000000 in this place the first output of the PLC will be on. When the PLC program ends the temporary number will just be saved in this special location of the memory and the outputs will be updated.

These three steps are all called a scan cycle. One scan cycle is when the PLC has checked the input status, executed the program and updated the output status.

If you want some further explanation of the PLC scan time, check out this great video from Ron Beaufort:


The PLC is a fast thinker and this cycle happens within milliseconds. But it will be relevant to know about the scan cycle and especially the scan time, which is the time one scan cycle takes. When we are working with timers and other advanced functions in the PLC the scan time can be crucial. The same happens with large projects with thousands of lines of code or ladder the scan time might become an issue.

Brand specific settings – More on scan times

As a comment on this post on reddit says, the PLC scan time are completely brand and setting specific. In many cases you can set different times for the I/O cycle time and the task cycle time.
The task cycle time is equal to the second step in this article – Execute PLC program.

All these brand specific settings and further information about the different PLC scan times will be in future articles. If you are starting out, learning PLC programming, you should just care about the scan time. Reading the I/O, then executing your program and at last updating the I/O is a good fundamental understanding of how a PLC works. When you are starting out learning PLC programming, knowing about the concept of the scan cycle is a huge advantage. In the beginning, this concept will help you understand the basic concepts of PLC programming.

If you have experience with PLC programming you may know of some scan cycle settings.

Have you ever used custom scan cycle settings?

Feel free to tell me about it in the comment section below.


Leave a response
  • manoj mavai
    October 3, 2015 at 5:47 am

    Dear sir
    larning and understanding material or ladder logic solution send in my mail?

  • Bonnie
    November 13, 2015 at 4:18 pm

    I am interested in learning PLC programming. I would like to enquirer if i could do the boot camp online. I am in Botswana.

    Kind regards,


    December 1, 2015 at 11:01 am

    If my scan time set for the PLC is 10ms and if program is getting scan in 5ms only then what will plc do for another 5ms.
    it will start next scan cycle or it will wailt for 5ms and then start.

  • Thomas Mfune
    February 28, 2016 at 3:01 pm

    I have done Plc programming Module 1 but I do not understand practically on scan time . The above notes are just too good, but the video was done too fast.

  • Gajanan Gunjal
    May 3, 2016 at 9:46 am

    Dear Sir,
    I have one question that in s7400 plc & remote io et200m configuration ,what is impact on plc scan time after addition of remote io’s.
    If is there any mathematical relation between plc scan time & input/output count please provide such info on my below email

  • sheis firoz
    June 12, 2016 at 7:14 pm

    Sir i want learn how can copy programme from any machine plc and how can save progrrame in plc

  • Gérard Nzebop
    August 6, 2016 at 2:52 pm

    Your article is very interesting for me.
    I am a student in Cameroon (Africa).
    I have two questions. They have been already asked by VINOD and Gajanan Gunjal (in part) :

    1- If the scan time of a PLC is fixed to 10ms and if the total duration of the real cycle is 5ms, would the PLC wait for 5ms before starting a new scan cycle?
    If so, what could be the necessity to fix the scan cycle ? Is it because of the frequency of specific Inputs or Outputs ?

    2- Does the process of scanning inputs and updating outputs takes time? The action of reading the input register and writing in the output register are they instantanuous? If no, what would be the mathematical relation between the scan cycle and its relevant elements?

    I would need a scientific paper presenting some PLCs and their scan cycle time !

Leave a Response