This model shows how to simulate and generate code for asynchronous events on a real-time multitasking system.
Open the example model
This model contains two asynchronously executed subsystems,
Count is executed at interrupt level, whereas
Algorithm is executed in an asynchronous task. The code generated for these blocks is specifically tailored for the VxWorks® operating system. However, you can modify the Async Interrupt and Task Sync blocks to generated code specific to your environment whether you are using an operating system or not.
Basis of operation for data transfers between tasks:
Data transitions occur between a single reading task and a single writing task.
A read or write of a byte sized variable is atomic.
When two tasks interact through a data transition, only one of them can preempt the other.
For periodic tasks, the faster rate task has higher priority than the slower rate task; the faster rate task always preempts the slower rate task.
All tasks run on a single processor. Time slicing is not allowed.
Processes do not crash/restart (especially while data is being transferred between tasks)