[previous] [index] [next]

Example 2: Pure Periodic Scheduling of Two Tasks

This example demonstrates two periodic tasks, one that toggles the speaker port and another that varies the frequency of toggling. In this example we will expand the number of tasks and use a simple shared variable. Refer to the commented source code of the example for the details.

Principle of Operation

Setting up the Tasks

Running the Demo

To run the demo, change to the 'ex02_twoper' subdirectory of the top-level tutorial directory, and run the 'run' script by typing
./run
Alternatively, change to the top-level tutorial directory and run the 'runall' script there by typing
./runall
and selecting the "Two Periodic Tasks" button.

You'll hear a series of tones for about 10 seconds, starting at 5 KHz acoustically and dropping in frequency as the second task increases the delay time used by the first.

See the Code


Next: Example 3, Variable Task Timing

Back: Example 1, A Single Periodic Task