Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 14 of 27

SYSMAC C20P/C28P/C40P/C60P P-type Programmable Controllers Operation Manual: SECTION 6

Pages 102 to 111 of 211, from SYSMAC C20P/C28P/C40P/C60P P-type Programmable Controllers Operation Manual

The original document is the PDF (2.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Omron C28P

Page 102

SECTION 6 Program Execution Timing 6–1 6–2 6–3

6–4 6–5

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Scan Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating Scan Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–3–1 Single PC Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–3–2 PC with Additional Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Instruction Execution Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

96 96 98 98 99 100 102

95

Page 103

Scan Time

6–1

Section 6–2

Introduction When writing and debugging a program, the timing of various operations must be considered. Not only is the time required to execute the program and perform other CPU operations important, but also the timing of each signal coming into and leaving the PC must be such that the desired control action is achieved at the right time. The major factors in determining program timing are the scan time and the I/O response time. One cycle of CPU operation is called a scan; the time required for one cycle is called the scan time. The time required to produce a control output signal following reception of an input signal is called the I/O response time. This section explains the scan and shows how to calculate the scan time and I/O response time.

6–2

Scan Time To aid in PC operation, the average scan time can be displayed on the Programming Console or any other Programming Device. Understanding the operations that occur during the scan and the elements that affect scan time is essential to effective programming and PC operations. The overall flow of CPU operation is as shown in the following flowchart.

96

Page 104

Section 6–2

Scan Time Power application

Clears IR area and resets all timers

Checks I/O Unit connections

Resets watchdog timer

Checks hardware and Program Memory

NO Check OK? Sets error flags and lights indicator

YES Services Peripheral Devices ERROR or ALARM ALARM Resets watchdog timer ERROR

Executes program

Resets watchdog timer

Input and output refreshing

The first three operations immediately after power application are performed once each time the PC is turned on. The then on the operations shown above are performed in cyclic fashion, with each cycle forming one scan. The scan time is the time that is required for the CPU to complete one of these cycles. This cycle includes four types of operation.

1, 2, 3... 1. 2. 3. 4.

Overseeing Input/Output refreshing Peripheral Device servicing Instruction execution

Scan time = Overseeing time + Input/output refreshing + Peripheral Device servicing time + Instruction execution time

97

Page 105

Section 6–3

Calculating Scan Time 1

Overseeing

Watchdog timer set and program memory and I/O bus checked.

1.26 ms (Fixed)

2

Peripheral Device servicing

Commands from Program Devices and Interface Units processed.

T = ( 1 + 3 + 4 ) x 0.05. T <= 1, execution time = 1 ms. T > 1, round off in units of 0.5 ms (e.g.,1.65 ms rounds to 1.5 ms) No peripherals connected = 0 ms.

3

Instruction execution

Instructions executed.

Total of execution time for each instruction. Varies with program size, the instructions used, and execution conditions. Refer to 6–4 Instruction Execution Times for details.

4

Input refreshing Output refreshing

Reading data input from input terminals and writing the results of instruction execution to output terminals.

0.29 ms + 0.07 ms times N where N = number of input and output words – 1.

The scan time can be obtained by adding the four scan time components identified above. An adequately short scan time is important to ensure efficient, error-free operation. Watchdog Timer and Long Scan Times

Within the PC, the watchdog timer measures the scan time and compares it to a set value. If the scan time exceeds the set value of the watchdog timer, an error is generated and the CPU stops. Even if the scan time does not exceed the set value of the watchdog timer, a long scan time can adversely affect the accuracy of system operations as shown in the following table.

6–3

Scan time (ms)

Possible adverse affects

10 or greater

TIMH(15) becomes inaccurate.

100 or greater

0.1-second clock pulse generator SR 1900 may malfunction.

Between 100 and 130

ALARM indicator on the CPU lights and SR 1809 turns ON.

130 or greater

ERROR indicator on the CPU lights and the system halts.

Calculating Scan Time The PC configuration, the program, and program execution conditions must be taken into consideration when calculating the scan time. This means taking into account such things as the number of I/O points, the programming instructions used, and whether or not Peripheral Devices are employed. This subsection shows some basic scan time calculation examples.

6–3–1

Single PC Unit Configuration: A single C20K CPU. Program: 300 addresses. Instructions Used: LD and OUT.

Calculations

The equation for the scan time from above is as follows:

Scan time = Overseeing time + Input/output refreshing + Peripheral device servicing time + Instruction execution time

98

Page 106

Section 6–3

Calculating Scan Time The overseeing time is fixed at 1.26 ms.

The input/output refresh time would be as follows: 0.29 ms + ( 0.07 ms x N ). As the C20K is provided with only one input and one output word the value of the constant N is 1 (i.e. N = 1 – 1 = 0) and so the time required is 0.29 ms + ( 0.07 ms x 0 ) = 0.29 ms. The execution time can be calculated by obtaining the average instruction execution time and multiplying this by the number of addresses used in the program. As only LD and OUT are used in this program and they have execution times of 12 µs and 17.5 µs respectively, the average instruction execution time is:

12 µs + 17.5 µs

= 14.75 ms

2 The total execution time is equal to this average instruction execution time multiplied by the number of program addresses. Total execution time = 300 addresses x 14.75 µs = 4.43 ms The peripheral device servicing time is calculated by adding the other three time values and multiplying the result by a factor of 0.05. This value is only required in configurations where a peripheral device is connected to the PC. The result is calculated as an example. As there are no peripheral devices used in this example the following results will be ignored in the final calculation. Peripheral device servicing = (1.26 ms + 0.29 ms + 4.43 ms) x 0.05 = 0.3 ms As this is less than 1 ms it must be rounded up to 1 ms. Had it been over 1 ms it would then need to be rounded down to the nearest 0.5 ms. The scan time is the total of all these calculations.

1.26 ms + 0.29 ms + 4.43 ms = 5.98 ms If a peripheral device had been present it would have been:

1.26 ms + 0.29 ms + 4.43 ms + 1 ms = 6.98 ms

6–3–2

Process

Formula

Peripheral device servicing (ms)

Overseeing Input/output refreshing Peripheral device servicing Instruction execution

Fixed 0.29 + 0.07 * (1–1) ((1) + (3) + (4)) * 0.05 = 0.3 < 1 14.75 * 300

With 1.26 0.29 1.00 4.43

Without 1.26 0.29 0.00 4.43

Total

(1) + (2) + (3) + (4)

6.98

5.98

PC with Additional Units Configuration: A C40K CPU, a C40P Expansion I/O Unit, an I/O Link Unit. Program: 1150 addresses. Average instruction execution time: 30 µs.

Calculations

The equation for the scan time from above is as follows: Scan time = Overseeing time + Input/output refreshing

99

Page 107

Section 6–4

Instruction Execution Times + Peripheral device servicing time + Instruction execution time The overseeing time is fixed at 1.26 ms.

The input/output refresh time would be as follows: 0.29 ms + (0.07 ms x N ). As the C40K is provided with only one input and one output word and the C40P Expansion unit contains input and output words the value of the constant N is 5. (i.e., N = 5 – 1 = 4) and so the time required is 0.29 ms + (0.07 ms x 4 ) = 0.57 ms. The total execution time can be calculated by obtaining the average instruction execution time and multiplying this by the number of addresses used in the program. As given above the average instruction execution time is 30 µs. Total execution time = 1150 addresses x 30 µs = 34.50 ms The peripheral device servicing time is calculated by adding the other three time values and multiplying the result by a factor of 0.05. This value is only required in configurations where a peripheral device is connected to the PC. The result is calculated as an example. As there are no peripheral devices used in this example the following results will be ignored in the final calculation. Peripheral device servicing = (1.26 ms + 0.57 ms + 34.50 ms) x 0.05 = 1.81 ms which is rounded down to 1.50 ms. The scan time is the total of all these calculations.

1.26 ms + 0.57 ms + 34.50 ms = 36.33 ms If a peripheral device had been present it would have been:

1.26 ms + 0.57 ms + 34.50 ms + 1.50 ms = 37.83 ms

6–4

Process

Formula

Peripheral device Servicing (ms)

Overseeing Input/output refreshing Peripheral device servicing Instruction execution

Fixed 0.29 + 0.07 * (1–1) ((1) + (3) + (4)) * 0.05 = 1.8 > 1 30 * 1150

With 1.26 0.57 1.50 34.50

Without 1.26 0.57 0.00 34.50

Total

(1) + (2) + (3) + (4)

37.83

36.33

Instruction Execution Times This following table lists the execution times for all instructions that are available for the P-types. The maximum and minimum execution times and the conditions which cause them are given where relevant. Execution times for most instructions depend on whether they are executed with an ON execution condition or an OFF execution condition. The OFF execution time for an instruction can also vary depending on the circumstances. Where this is the case, the circumstances that will produce different execution times are given. Execution times are expressed in microseconds except where noted.

100

Page 108

Section 6–4

Instruction Execution Times Function Instruction code

Execution time(µs)

Conditions

LD

12

Always

LD NOT

12

Always

AND

11.5

Always

AND NOT

11.5

Always

OR

11.5

Always

OR NOT

11.5

Always

AND LD

4

Always

OR LD

4

Always

OUT

17

When outputting logical ”1” (ON)

17.5

When outputting logical ”0” (OFF)

19

When outputting logical ”1” (ON)

17.5

When outputting logical ”0” (OFF)

95

When timing

95.5 to 186.5

When reset

80.5

When counting

OUT NOT TIM CNT

91.5 TO 184

When reset

00

NOP

2

Always

01

END, Refer to Scan Time Calculation Example.

02

IL

2.5

Always

03

ILC

3

Always

04

JMP

94

Always

05

JME

38

Always

10

SFT

102

When shifting 1 word

248

When shifting 13 words

90 to 254

When reset (1 to 13 words)

19

When set

20

When reset

95

When counting DOWN

190.5

When counting UP (word specified)

60.5

When input = 1

56.5

When input = 0

59

When input = 1

62.5

When input = 0

94.5

When timing

97 to 187.5

When reset

97

When shifting DM by 1 word

825.5

When shifting DM by 64 words

121.5

When comparing a constant with word data

212

When comparing a TIM/CNT with word data

109

When transferring a constant to a word

196

When transferring a TIM/CNT to a word

108.5

When inverting & transferring a constant to a word

196

When inverting & transferring a TIM/CNT to a word

115

When converting & transferring a TIM/CNT to a word

193.5

When converting & transferring a word to a word

194

When converting & transferring DM to DM

202.5

When converting & transferring data in other areas

11 12 13 14 15 16 20 21 22 23 24

KEEP CNTR DIFU DIFD TIMH WSFT CMP MOV MVN BIN BCD

101

Page 109

Section 6–5

I/O Response Time

6–5

Function code

Instruction

Execution time(µs)

Conditions

30

ADD

31

SUB

40 41 61 76

STC CLC HDM MLPX

77

DMPX

233 352 237.5 356.5 16 16 734 212.5 288 355 431 298.5 658.5 456 1,080 145 743

When adding two words When adding a TIM/CNT to a constant When subtracting a word from a word When subtracting a constant from a TIM/CNT Always Always Always Word, 1 digit (constant), > word Word, 4 digits (constant), > word TIM/CNT, 1 digit (TIM/CNT), > word TIM/CNT, 4 digits (TIM/CNT), > word Word, 1 digit (constant), > word Word, 4 digits (constant), > word TIM/CNT, 1 digit (TIM/CNT), > word TIM/CNT, 4 digits (TIM/CNT), > word When shifting one word When shifting 64 DM words

I/O Response Time The I/O response time is the time it takes for the PC to output a control signal after it has received an input signal. How long it takes to respond depends on the scan time and when the CPU receives the input signal relative to the input refresh period. The I/O response times for a PC not in a Link System are discussed below. For response times for PCs with Link Systems, refer to the relevant System Manual. The minimum and maximum I/O response time calculations described below are for the following, where 0000 is the input bit that receives the signal and 0500 is the output bit corresponding to the desired output point.

0000

0500

Minimum I/O Response Time

102

The PC responds most quickly when it receives an input signal just prior to the input refresh period in the scan. Once the input bit corresponding to the signal has been turned ON, the program will have to be executed once to turn ON the output bit for the desired output signal and then the input refresh and overseeing operations would have to be repeated before the output from the output bit was refreshed. The I/O response time in this case is thus found by adding the input ON-delay time, the scan time, the I/O refresh time, the overseeing time, and the output ON-delay time. This situation is illustrated below.

Page 110

Section 6–5

I/O Response Time Overseeing CPU reads input signal Scan time

Scan time

Scan I/O refresh Input signal

CPU writes output signal

Input ON delay

Output ON delay

Output signal I/O response time

Minimum I/O response time = Input ON delay + Scan time + I/O refresh time + Overseeing time + Output ON delay

Maximum I/O Response Time

The PC takes longest to respond when it receives the input signal just after the input refresh phase of the scan. In this case the CPU does not recognize the input signal until the end of the next scan. The maximum response time is thus one scan longer than the minimum I/O response time, except that the input refresh time would not need to be added in because the input comes just after it rather than before it.

Overseeing Scan time

Scan time

Scan I/O refresh Input signal

CPU reads input signal Input ON delay

CPU writes output signal Output ON delay

Output signal I/O response time

Maximum I/O response time = input ON delay + (scan time x 2) + overseeing time + output ON delay

103

Page 111

Section 6–5

I/O Response Time Calculation Example

The data in the following table would produce the minimum and maximum scan times shown calculated below.

Input ON-delay

1.5 ms

Scan time

20 ms

Input refresh time

0.23 ms

Overseeing time

3.0 ms

Output ON-delay

15 ms

Minimum I/O response time = 1.5 + 20 + 0.23 + 3.0 +15 = 39.73 ms Maximum I/O response time = 1.5 + (20 x 2) + 3.0 +15 = 59.5 ms

104