欢迎访问ic37.com |
会员登录 免费注册
发布采购

PIC16F818-I/P 参数 Datasheet PDF下载

PIC16F818-I/P图片预览
型号: PIC16F818-I/P
PDF下载: 下载PDF文件 查看货源
内容描述: 二十零分之一十八引脚增强型闪存微控制器采用纳瓦技术 [18/20-Pin Enhanced Flash Microcontrollers with nanoWatt Technology]
分类和应用: 闪存微控制器和处理器外围集成电路光电二极管PC时钟
文件页数/大小: 176 页 / 2941 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC16F818-I/P的Datasheet PDF文件第59页浏览型号PIC16F818-I/P的Datasheet PDF文件第60页浏览型号PIC16F818-I/P的Datasheet PDF文件第61页浏览型号PIC16F818-I/P的Datasheet PDF文件第62页浏览型号PIC16F818-I/P的Datasheet PDF文件第64页浏览型号PIC16F818-I/P的Datasheet PDF文件第65页浏览型号PIC16F818-I/P的Datasheet PDF文件第66页浏览型号PIC16F818-I/P的Datasheet PDF文件第67页  
PIC16F818/819  
7.8  
Resetting Timer1 Using a CCP  
Trigger Output  
7.11 Using Timer1 as a  
Real-Time Clock  
If the CCP1 module is configured in Compare mode to  
generate “special event trigger” signal  
(CCP1M3:CCP1M0 = 1011), the signal will reset  
Timer1 and start an A/D conversion (if the A/D module  
is enabled).  
Adding an external LP oscillator to Timer1 (such as the  
one described in Section 7.6 “Timer1 Oscillator”),  
gives users the option to include RTC functionality in  
their applications. This is accomplished with an inex-  
pensive watch crystal to provide an accurate time base  
and several lines of application code to calculate the  
time. When operating in Sleep mode and using a  
battery or supercapacitor as a power source, it can  
completely eliminate the need for a separate RTC  
device and battery backup.  
a
Timer1 must be configured for either Timer or Synchro-  
nized Counter mode to take advantage of this feature.  
If Timer1 is running in Asynchronous Counter mode,  
this Reset operation may not work.  
In the event that a write to Timer1 coincides with a  
special event trigger from CCP1, the write will take  
precedence.  
The application code routine, RTCisr, shown in  
Example 7-3, demonstrates  
a simple method to  
increment a counter at one-second intervals using an  
Interrupt Service Routine. Incrementing the TMR1  
register pair to overflow, triggers the interrupt and calls  
the routine which increments the seconds counter by  
one; additional counters for minutes and hours are  
incremented as the previous counter overflows.  
In this mode of operation, the CCPR1H:CCPR1L  
register pair effectively becomes the period register for  
Timer1.  
7.9  
Resetting Timer1 Register Pair  
(TMR1H, TMR1L)  
Since the register pair is 16 bits wide, counting up to  
overflow the register directly from a 32.768 kHz clock  
would take 2 seconds. To force the overflow at the  
required one-second intervals, it is necessary to pre-  
load it; the simplest method is to set the MSb of TMR1H  
with a BSFinstruction. Note that the TMR1L register is  
never preloaded or altered; doing so may introduce  
cumulative error over many cycles.  
TMR1H and TMR1L registers are not reset to 00h on a  
POR or any other Reset, except by the CCP1 special  
event triggers.  
T1CON register is reset to 00h on a Power-on Reset or  
a Brown-out Reset, which shuts off the timer and  
leaves a 1:1 prescale. In all other Resets, the register  
is unaffected.  
For this method to be accurate, Timer1 must operate in  
Asynchronous mode and the Timer1 overflow interrupt  
must be enabled (PIE1<0> = 1) as shown in the routine,  
RTCinit. The Timer1 oscillator must also be enabled  
and running at all times.  
7.10 Timer1 Prescaler  
The prescaler counter is cleared on writes to the  
TMR1H or TMR1L registers.  
2004 Microchip Technology Inc.  
DS39598E-page 61