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.

Built-in Functions<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Sets the current value of the timer. All timers count up. When a timer<br />

reaches the maximum value it will flip over to 0 and continue counting<br />

(254, 255, 0, 1, 2, …).<br />

This function is only available on devices with Timer B hardware.<br />

Nothing<br />

// 20 mhz clock, no prescaler, set timer B<br />

// to overflow in 35us<br />

set_timerB(81); // 256-(.000035/(4/20000000))<br />

Example Files:<br />

Also See:<br />

none<br />

get_timerB( ), setup_timer_B( ), TimerB Overview<br />

set_timerx( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example<br />

Files:<br />

Also See:<br />

set_timerX(value)<br />

A 16 bit integer, specifiying the new value of the timer.<br />

(int16)<br />

void<br />

Allows the user to set the value of the timer.<br />

This function is available on all devices that have a valid<br />

timerX.<br />

Nothing<br />

if(EventOccured())<br />

set_timer2(0);//reset the timer.<br />

None<br />

Timer Overview, set_timerX()<br />

set_rtcc( ) set_timer0( ) set_timer1( ) set_timer2( )<br />

set_timer3( ) set_timer4( ) set_timer5( )<br />

Syntax: set_timer0(value) or set_rtcc (value)<br />

set_timer1(value)<br />

set_timer2(value)<br />

277

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

Saved successfully!

Ooh no, something went wrong!