Maximizing System Performance

C-3

 

 

If you use subroutines, program scan times can vary by the scan time of entire logic files.

Effects of Different Instructions on Logic Scan Time

Some instructions have a much greater effect on logic scan time than others based on the time that it takes to execute each instruction.

Program scan time is also affected by the construction of your ladder rungs. The size of the rung and the number of branches can cause the scan time to fluctuate greatly.

Effects of Using Interrupts on Logic Scan Time

Program scan time is also affected by interrupt programs. An interrupt is a special situation that causes a separate program to run independently from the normal program scan. You define the special event and the type of interrupt that is to occur. For more information on interrupt programs, see chapters 18 and 19.

For example, a selectable timed interrupt (STI) is a program file that you define to execute once every time period. The example shown below has these parameters:

you configure an STI to execute every 20 ms

the STI program takes 3 ms to execute

the logic scan is 21.8 ms

housekeeping takes 3.2 ms

The first program scan in this example lasts a total of 28 ms. The program scans look like:

Program Scan 1

Time = 20 ms

STI Logic Scan

Housekeeping

Time = 0

 

 

 

 

Program Scan 2

 

 

3.2 +

21.8

+ 3

= 28 ms

 

 

 

 

 

 

 

Time = 40 ms

 

 

 

 

 

 

 

STI

 

 

House-

Logic

STI

 

 

 

 

 

 

 

 

 

Time = 40 ms (20 ms + 20 ms)

keeping

Scan

Scan

 

 

 

 

 

 

 

 

 

 

but program scan 1 = 28 ms,

 

 

 

 

 

 

 

 

 

 

 

 

 

meaning that the STI interrupts

 

 

 

 

 

 

 

 

 

Logic Scan

 

12 ms into the second

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

program scan.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The STI occurred 20 ms

 

Housekeeping

 

 

 

 

Time = 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

into the first program scan.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Publication 1785-UM012D-EN-P - July 2005

Page 289
Image 289
Bradley Smoker PLC-5 Effects of Different Instructions on Logic Scan Time, Effects of Using Interrupts on Logic Scan Time