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.

setup_timer_1( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

setup_timer_1 (mode)<br />

mode values may be:<br />

T1_DISABLED, T1_INTERNAL, T1_EXTERNAL,<br />

T1_EXTERNAL_SYNC<br />

T1_CLK_OUT<br />

T1_DIV_BY_1, T1_DIV_BY_2, T1_DIV_BY_4, T1_DIV_BY_8<br />

constants from different groups may be or'ed together with |.<br />

undefined<br />

Initializes timer 1. The timer value may be read and written to using<br />

SET_TIMER1() and GET_TIMER1()Timer 1 is a 16 bit timer.<br />

With an internal clock at 20mhz and with the T1_DIV_BY_8 mode, the timer<br />

will increment every 1.6us. It will overflow every 104.8576ms.<br />

Availability:<br />

Requires:<br />

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

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

Examples:<br />

setup_timer_1 ( T1_DISABLED );<br />

setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_4 );<br />

setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_8 );<br />

Example Files:<br />

Also See:<br />

get_timer1(), set_timer1() , Timer1 Overview<br />

setup_timer_2( )<br />

Syntax:<br />

Parameters:<br />

setup_timer_2 (mode, period, postscale)<br />

mode may be one of:<br />

T2_DISABLED<br />

T2_DIV_BY_1, T2_DIV_BY_4, T2_DIV_BY_16<br />

Period is a int 0-255 that determines when the clock value is reset<br />

Postscale is a number 1-16 that determines how many timer overflows<br />

before an interrupt: (1 means once, 2 means twice, an so on)<br />

304

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

Saved successfully!

Ooh no, something went wrong!