User`s guide

6 Program Architecture
6-14
The following diagram illustrates interrupt timing.
Figure 6-2: Task Timing
Thesampleintervalmustbelongenoughtoallowmodelcodeexecution
between task invocations.
In the figure above, the time between two adjacent vertical arrows is the
sample interval. The empty boxes in the upper diagram show an example of a
program that can complete one step within the interval and still allow time for
the background task. The gray box in the lower diagram indicates what
happens if the sample interval is too short. Another task invocation occurs
before the task is complete. Such timing results in an execution error.
Note also that, if the real-time program is designed to run forever (i.e., the final
time is 0 or infinite so the while loop never exits), then the shutdown code never
executes.
time
Time to execute
Time available to process background tasks
the model code
Sample interval is appropriate for this model code execution.
time
Time to execute the model code
Sample interval is too short for this model code execution.