In addition to scanning the ladder logic, the PLC processor must also read the state of its physical inputs and set the state of the physical outputs. These three major tasks in a PLC processor scan are executed in the following order:
- Read the physical inputs
- Scan the ladder logic program
- Write the physical outputs
The processor repeats these tasks as long as it is running. The time required to complete these three tasks is defined as the scan time and is typically 1 - 200 milliseconds, depending on the length of the ladder logic program.
For very large ladder logic programs, the scan time can be more than one second. When this happens, the PLC program may miss transient events, especially if they are shorter than one second. In this situation, the possible solutions are:
Break ladder logic into subroutines that are executed at a slower rate and execute the logic to detect the transient event on every scan.
Lengthen the time of the transient event so that it is longer than the maximum scan time. If the event is counted, both the on time and off time of the event must be longer than the scan time. A counter must sense both values to work correctly.
Place the logic examining the transient in a ladder logic routine that is executed at a fixed time interval, smaller than the length of the transient event.
Partition long calculations. For example, if calculating the solution to an optimization, do one iteration per scan cycle rather than execute the entire algorithm every scan.
Depending on the PLC processor, one or more of these solutions may be unavailable.
Normally, during the ladder logic program scan, changes in physical inputs cannot be sensed, nor can physical outputs be changed at the output module terminals.
However, some PLC processors have an instruction that can read the current state of a physical input and another instruction that can immediately set the current state of a physical output.
However, using the immediate input/output instruction incurs a severe time