17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

task that is scheduled to execute at the appropriate time. This<br />

process is called cooperative multi-tasking.<br />

Syntax:<br />

Elements:<br />

#USE RTOS (options)<br />

options are separated by comma and may be:<br />

timer=X<br />

Where x is 0-4 specifying the timer used by the<br />

RTOS.<br />

minor_cycle=time<br />

Where time is a number followed by s, ms, us, ns.<br />

This is the longest time any task will run. Each<br />

task's execution rate must be a multiple of this<br />

time. The compiler can calculate this if it is not<br />

specified.<br />

statistics<br />

Maintain min, max, and total time used by each<br />

task.<br />

This directive tells the compiler which timer on the PIC to use for monitoring and<br />

when to grant control to a task. Changes to the specified timer's prescaler will<br />

effect the rate at which tasks are executed.<br />

Purpose:<br />

This directive can also be used to specify the longest time that a task will ever take<br />

to execute with the minor_cycle option. This simply forces all task execution rates<br />

to be a multiple of the minor_cycle before the project will compile successfully. If<br />

the this option is not specified the compiler will use a minor_cycle value that is the<br />

smallest possible factor of the execution rates of the RTOS tasks.<br />

If the statistics option is specified then the compiler will keep track of the minimum<br />

processor time taken by one execution of each task, the maximum processor time<br />

taken by one execution of each task, and the total processor time used by each<br />

task.<br />

When linking multiple compilation units, this directive must appear exactly the<br />

same in each compilation unit.<br />

Examples:<br />

Also See:<br />

#use rtos(timer=0, minor_cycle=20ms)<br />

#TASK<br />

#use spi<br />

Syntax:<br />

Elements:<br />

#USE SPI (options)<br />

Options are separated by commas and may be:<br />

MASTER<br />

Set the device as the master. (default)<br />

SLAVE<br />

Set the device as the slave.<br />

BAUD=n<br />

Target bits per second, default is as fast as<br />

possible.<br />

144

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!