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.

Built-in Functions<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

undefined<br />

Initializes timer 2. The mode specifies the clock divisor (from the oscillator<br />

clock).<br />

The timer value may be read and written to using GET_TIMER2() and<br />

SET_TIMER2().<br />

2 is a 8-bit counter/timer.<br />

This function is only available on devices with timer 2 hardware.<br />

Constants are defined in the devices .h file.<br />

Examples:<br />

setup_timer_2 ( T2_DIV_BY_4, 0xc0, 2) //at 20mhz, the timer will<br />

//increment every 800ns<br />

//will overflow every 154.4us,<br />

//and will interrupt every 308.us<br />

Example Files:<br />

Also See:<br />

get_timer2(), set_timer2() , Timer2 Overview<br />

setup_timer_3( )<br />

Syntax:<br />

setup_timer_3 (mode)<br />

Parameters: Mode may be one of the following constants from each group or'ed (via |)<br />

together:<br />

T3_DISABLED, T3_INTERNAL, T3_EXTERNAL,<br />

T3_EXTERNAL_SYNC<br />

T3_DIV_BY_1, T3_DIV_BY_2, T3_DIV_BY_4, T3_DIV_BY_8<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

undefined<br />

Initializes timer 3 or 4.The mode specifies the clock divisor (from the oscillator<br />

clock). The timer value may be read and written to using GET_TIMER3() and<br />

SET_TIMER3(). Timer 3 is a 16 bit counter/timer.<br />

This function is only available on devices with timer 3 hardware.<br />

Constants are defined in the devices .h file.<br />

setup_timer_3 (T3_INTERNAL | T3_DIV_BY_2);<br />

None<br />

305

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

Saved successfully!

Ooh no, something went wrong!