5 Programming HIMax System
HI 801 001 E Rev. 4.01 Page 74 of 122
i
The unused execution time of user programs that were not run cannot be exploited as
residual time by other user programs. User programs are not run if they are in one of the
following states:
STOP
ERROR
TEST_MODE
As a consequence, the number of CPU cycles required to process another user program
cycle could increase.
In such a case, if the value set for Maximum Cycle Count is too low, the maximum
time for processing a user program can be exceeded and result in an error stop!
Maximum processing time = Max. Duration for Each Cycle [µs] * Maximum Number
of Cycles
Use multitasking mode 3 to verify the parameter setting!
3. Multitasking mode 3 does not use the unneeded duration for running the user
programs, rather, it waits until the Max. Duration for Each Cycle [µs] of the user program
is reached and then starts processing the next user program. This behavior results in
CPU cycles of the same duration.
Multitasking mode 3 allows users to verify if multitasking mode 2 ensures proper
program execution, even in the worst case scenario.
Example:
First CPU Cycle Considered.
Second CPU Cycle Considered.
Third CPU Cycle Considered.
The Max. Duration for Each Cycle [µs]
of UP 1 has Expired, UP 2 Starts.
The Max. Duration for Each Cycle [µs]
of UP 2 has Expired, UP 3 Starts.
The UP 3 Max. Duration for Each Cycle
[µs] has Expired, Completion of the
First CPU Cycle. UP 1 Resumes.
Completion of the UP 1 Cycle. Waiting
for the Remaining Duration.
The UP 1 Max. Duration for Each Cycle
[µs] has Expired, UP 2 Resumes.
Completion of the UP 2 Cycle. Waiting
for the Remaining Duration.
The UP 3 Max. Duration for Each Cycle
[µs] has Expired. Completion of the
Second CPU Cycle.
The next User Program Cycle of UP 1
Starts.
Max. Duration for Each Cycle [µs] of
UP 1 has Expired. The next User Pro-
gram Cycle of UP 2 starts .
Max. Duration for Each Cycle [µs] of
UP 2 has Expired. UP 3 Resumes.
Completion of the UP 3 Cycle. Standby
Time Until the UP 3 Max. Duration for
Each Cycle [µs] has Expired. Comple-
tion of the Third CPU Cycle.
Figure 15: Multitasking Mode 3