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.

flip over to 0 and continue counting (254, 255, 0, 1, 2...)<br />

Availability:<br />

Requires:<br />

Timer 0 - All devices<br />

Timers 1 & 2 - Most but not all <strong>PCM</strong> devices<br />

Timer 3 - Only PIC18XXX and some pick devices<br />

Timer 4 - Some <strong>PCH</strong> devices<br />

Timer 5 - Only PIC18XX31<br />

Nothing<br />

Examples:<br />

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

// to overflow in 35us<br />

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

Example Files:<br />

Also See:<br />

ex_patg.c<br />

set_timer1(), get_timerX() Timer0 Overview, Timer1Overview, Timer2<br />

Overview, Timer5 Overview<br />

set_ticks( )<br />

Syntax:<br />

Parameters:<br />

set_ticks([stream],value);<br />

stream – optional parameter specifying the stream defined in #USE<br />

TIMER<br />

value – a 8, 16 or 32 bit integer, specifying the new value of the tick timer.<br />

(int8, int16 or int32)<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

void<br />

Sets the new value of the tick timer. Size passed depends on the size of<br />

the tick timer.<br />

All devices.<br />

#USE TIMER(options)<br />

#USE TIMER(TIMER=1,TICK=1ms,BITS=16,NOISR)<br />

void main(void) {<br />

unsigned int16 value = 0x1000;<br />

}<br />

set_ticks(value);<br />

Example Files:<br />

Also See:<br />

None<br />

#USE TIMER, get_ticks()<br />

274

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

Saved successfully!

Ooh no, something went wrong!