Download C Compiler User Manual

Transcript
C Compiler Reference Manual
Built-In Functions
Parameters:
mode may be one of:
T2_DISABLED,
T2_DIV_BY_1,
T2_DIV_BY_16
T2_DIV_BY_4,
period is a int 0-255 that determines when the clock
value is reset,
postscale is a number 1-16 that determines how many
timer resets before an interrupt: (1 means one reset, 2
means 2, and so on).
Returns:
undefined
Function:
Initializes timer 2. The mode specifies the clock divisor
(from the oscillator clock). The timer value may be
read and written to using GET_TIMER2() and
SET_TIMER2(). Timer 2 is a 8 bit counter/timer.
Availability:
This function is only available on devices with timer 2
hardware.
Requires
Constants are defined in the devices .h file.
Examples:
setup_timer_2 ( T2_DIV_BY_4, 0xc0, 2);
// At 20mhz, the timer will include every 800ns,
// will overflow every 153.6us,
// and will interrupt every 460.3us.
Example Files:
ex_pwm.c
Also See:
get_timer2(), set_timer2()
SETUP_TIMER_3( )
Syntax:
setup_timer_3 (mode)
Parameters:
Mode may be one of the following constants from each
group or'ed (via |) together:
T3_DISABLED,
T3_INTERNAL,
T3_EXTERNAL,
154