You are on page 1of 1

C Compiler Reference Manual

#TASK
Each RTOS task is specified as a function that has no parameters and no return.
The #task directive is needed just before each RTOS task to enable the compiler
to tell which functions are RTOS tasks. An RTOS task cannot be called directly
like a regular function can.
Syntax:
Elements:

Purpose:

#task (options)
options are separated by comma and may be:
rate=time
Where time is a number followed by s,
ms, us, or ns. This specifies how often
the task will execute.
max=time
Where time is a number followed by s,
ms, us, or ns. This specifies the
budgeted time for this task.
queue=bytes
Specifies how many bytes to allocate for this
task's incoming messages. The default
value is 0.
This directive tells the compiler that the following function is
an RTOS task.
The rate option is used to specify how often the task should
execute. This must be a multiple of the minor_cycle option if
one is specified in the #use rtos directive.
The max option is used to specify how much processor time
a task will use in one execution of the task. The time
specified in max must be equal to or less than the time
specified in the minor_cycle option of the #use rtos directive
before the project will compile successfully. The compiler
does not have a way to enforce this limit on processor time,
so a programmer must be careful with how much processor
time a task uses for execution. This option does not need to
be specified.
The queue option is used to specify the number of bytes to
be reserved for the task to receive messages from other
tasks or functions. The default queue
value is 0.

Examples:

#task(rate=1s, max=20ms,

Also See:

#use rtos

62

queue=5)

You might also like