Chapter 4. CPU module
4 - 18
8) Example of program configuration and processing
When the task and program have been registered as below,
•
Task registration : T_SLOW (interval : T#10ms, priority : = 0)
PROC_1 (single : %MX0, priority : = 3)
E_INT1 (interrupt : %IX0.0.1, priority : = 0)
•
program registration : program
→
P0
program
→
P1 with the task T_SLOW
program
→
P2 with the task PROC_1
program
→
P3 with the task E_INT1
If program execution time is equal to external interrupt occurrence time :
•
Execution time for each program : P0 = 17 ms, P1 = 2 ms, P2 = 7 ms, P3 = 2 ms
•
Interrupt E_INT occurrence time : Occurred at the 6, 7, 20 ms after the operation started.
•
PROC_1 : Invoked during execution of scan program
Program execution is shown as below.
•
Processing with time
0 [ms] : Scan starts and the scan program P0 starts its execution.
0 to 6 [ms] : The program P0 is being executed.
6 to 8 [ms] : Execution request for P3 is input, and P0 is stopped and P3 is executed. Execution request for
P1 by E_INT1 at the 7 [ms] is ignored as the P2 is being executed.
8 to 10 [ms] : P3 finishes its execution and the P0 stopped continues its execution.
10 to 12 [ms] : P0 is stopped and P1 is executed due to execution request for P1.
12 to 20 [ms] : P2 finishes its execution and the P0 stopped continues its execution.
20 [ms] : Execution requests for P1 and P3 are simultaneously exist, but the higher priority P1 is executed
and P3 is ready for its execution.
20 to 22 [ms] : P0 is stopped and P1 is executed.
22 to 24 [ms] : P1 finishes its execution and the higher priority P3 is executed before P0.
24 to 25 [ms] : P3 finishes its execution and the P0 stopped completes its execution.
25 [ms] : Execution request for P2 is checked at the finish time of the scan program (P0) and P2 is executed.
25 to 30 [ms] : The program P2 is executed.
30 to 32 [ms] : Execution request for P1 is input and P2 is stopped and P1 finishes its execution.
32 to 34 [ms] : P1 finishes its execution and the P2 stopped finishes its execution.
34 [ms] : A new scan starts. (P0 starts its execution.)