Microchip Technology PICkit 3 Debug Express Debugger/Programmer (DV164131) PICkit 3 Debug Express DV164131 数据表

产品代码
DV164131
下载
页码 78
PICkit™ 3 Debug Express
DS41370C-page 34
 
© 2009 Microchip Technology Inc.
FIGURE 3-25:
T0CON: TIMER0 CONTROL REGISTER
To use Timer0 to replace the software delay Delay1KTCYx(50), it should be set up 
so it overflows about every 200 to 300 ms. Let’s go over the T0CON bit settings to make 
this happen:
T08BIT = 0
Timer0 is configured as a 16-bit timer/counter to illustrate the buffering of TMR0H.
T0CS = 0
Timer0 runs off the internal instruction clock. At Fosc = 1MHz, the instruction clock 
is 250kHz.
T0SE = 0
If Timer0 was running off the T0CKI pin, this bit would determine whether it incre-
mented on the falling edge or rising edge of the T0CKI pin signal. Since we are 
running off the instruction clock, this bit is a “don’t care.” This means operation is 
not affected by either setting of this bit.
PSA = 1
The timer will overflow in 65536 counts. At the instruction clock rate of 250 kHz, 
the timer overflow will occur every 65536 x (1 / 250,000) = 262ms. This is a time in 
the range we want, so the prescaler is not assigned to Timer0. It runs directly off 
the instruction clock.