[previous] [index] [next]

Example 1: Pure Periodic Scheduling of a Single Task

This example demonstrates a single fixed-period task that toggles the speaker at 1 kHz, also demonstrating how to read and write I/O addresses. In this example we will introduce the basics of RT Linux, and refer to the commented source code of the example for the details.

Principle of Operation

Setting Up a Single Periodic Task

The relevant RTAI functions are documented in the RTAI documentation. In this example we will do the following:

Setting Up the Timer

The Task Function

Setting Up the Task Structure

Scheduling the Task

Running the Demo

To run the demo, change to the 'ex01_periodic' 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 "Single Periodic Task" button.

You'll hear a tone corresponding to 1 KHz toggling (500 Hz for a full period) for about 10 seconds.

See the Code


Next: Example 2: Pure Periodic Scheduling of Two Tasks

Back: The Basics of Real-Time Linux