17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Functional Overview<br />

None<br />

Relevant Interrupts :<br />

INT_TIMER5<br />

Relevant Include Files:<br />

Interrupt fires when timer5 overflows<br />

None, all functions built-in<br />

Relevant getenv() parameters:<br />

TIMER5<br />

Returns 1 if the device has timer5<br />

Example Code:<br />

For PIC18F4431<br />

setup_timer_5(T5_DISABLED)<br />

//disables timer5<br />

or<br />

setup_timer_5(T5_INTERNAL|T5_DIV_BY_1); //sets the internal clock as source and<br />

//prescale as 1.<br />

//At 20Mhz timer5 will increment every .2us in<br />

this<br />

//setup and overflows every 13.1072ms<br />

set_timer5(0); //this sets timer5 register to 0<br />

time=get_timer5();<br />

//this will read the timer5 register value<br />

TimerA<br />

These options lets the user configure and use timerA. It is available on devices with Timer A<br />

hardware. The clock/counter is 8 bit. It counts up and also provides interrupt on overflow. The<br />

options available are listed in the device's header file.<br />

Relevant Functions:<br />

setup_timer_A(mode)<br />

set_timerA(value)<br />

value=get_timerA()<br />

Relevant Preprocessor:<br />

None<br />

Disable or sets the source and prescale for timerA<br />

Initializes the timerA clock/counter<br />

Returns the value of the timerA clock/counter<br />

Relevant Interrupts :<br />

INT_TIMERA<br />

Relevant Include Files:<br />

Interrupt fires when timerA overflows<br />

None, all functions built-in<br />

Relevant getenv() parameters:<br />

TIMERA<br />

Returns 1 if the device has timerA<br />

73

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

Saved successfully!

Ooh no, something went wrong!