设置初值
see help file
Syntax: set_timer0(value) or set_rtcc (value)
set_timer1(value)
set_timer2(value)
set_timer3(value)
Parameters: Timers 1 and 3 get a 16 bit int.
Timer 2 gets an 8 bit int.
Timer 0 (AKA RTCC) gets an 8 bit int except on the PIC18XXX where it needs a 16 bit int.
Returns: undefined
Function: Sets the count value of a real time clock/counter. RTCC and Timer0 are the same.
All timers count up. When a timer reaches the maximum value it will flip over to 0 and continue counting (254, 255, 0, 1, 2...).
Availability: Timer 0 - All devices
Timers 1,2 - Most but not all PCM devices
Timer 3 - Only PIC18XXX
Requires: Nothing
Examples:
// 20 mhz clock, no prescaler, set timer 0
// to overflow in 35us
set_timer0(81); // 256-(.000035/(4/20000000))
Example Files: ex_patg.c
Also See: set_timer1(), get_timerX()