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

PIC16F777-I/PT 参数 Datasheet PDF下载

PIC16F777-I/PT图片预览
型号: PIC16F777-I/PT
PDF下载: 下载PDF文件 查看货源
内容描述: 28 /40/ 44引脚, 8位CMOS闪存微控制器与10位A / D和纳瓦技术 [28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with 10-Bit A/D and nanoWatt Technology]
分类和应用: 闪存微控制器
文件页数/大小: 276 页 / 4898 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC16F777-I/PT的Datasheet PDF文件第78页浏览型号PIC16F777-I/PT的Datasheet PDF文件第79页浏览型号PIC16F777-I/PT的Datasheet PDF文件第80页浏览型号PIC16F777-I/PT的Datasheet PDF文件第81页浏览型号PIC16F777-I/PT的Datasheet PDF文件第83页浏览型号PIC16F777-I/PT的Datasheet PDF文件第84页浏览型号PIC16F777-I/PT的Datasheet PDF文件第85页浏览型号PIC16F777-I/PT的Datasheet PDF文件第86页  
PIC16F7X7  
7.5.1  
READING AND WRITING TIMER1 IN  
ASYNCHRONOUS COUNTER MODE  
7.5  
Timer1 Operation in  
Asynchronous Counter Mode  
Reading TMR1H or TMR1L while the timer is running  
from an external asynchronous clock will ensure a valid  
read (taken care of in hardware). However, the user  
should keep in mind that reading the 16-bit timer in two  
8-bit values itself, poses certain problems, since the  
timer may overflow between the reads.  
If control bit, T1SYNC (T1CON<2>), is set, the external  
clock input is not synchronized. The timer continues to  
increment asynchronous to the internal phase clocks.  
The timer will continue to run during Sleep and can  
generate an interrupt on overflow that will wake-up the  
processor. However, special precautions in software  
are needed to read/write the timer (Section 7.5.1  
“Reading and Writing Timer1 in Asynchronous  
Counter Mode”).  
For writes, it is recommended that the user simply stop  
the timer and write the desired values. A write conten-  
tion may occur by writing to the Timer registers while  
the register is incrementing. This may produce an  
unpredictable value in the Timer register.  
In Asynchronous Counter mode, Timer1 cannot be  
used as a time base for capture or compare operations.  
Reading the 16-bit value requires some care. The  
example codes provided in Example 7-1 and  
Example 7-2 demonstrate how to write to and read  
Timer1 while it is running in Asynchronous mode.  
EXAMPLE 7-1:  
WRITING A 16-BIT FREE RUNNING TIMER  
; All interrupts are disabled  
CLRF  
TMR1L  
; Clear Low byte, Ensures no rollover into TMR1H  
MOVLW  
MOVWF  
MOVLW  
MOVWF  
HI_BYTE  
TMR1H, F  
LO_BYTE  
TMR1H, F  
; Value to load into TMR1H  
; Write High byte  
; Value to load into TMR1L  
; Write Low byte  
; Re-enable the Interrupt (if required)  
CONTINUE  
; Continue with your code  
EXAMPLE 7-2:  
READING A 16-BIT FREE RUNNING TIMER  
; All interrupts are disabled  
MOVF  
MOVWF  
MOVF  
MOVWF  
MOVF  
SUBWF  
BTFSC  
GOTO  
TMR1H, W  
TMPH  
TMR1L, W  
TMPL  
TMR1H, W  
TMPH, W  
STATUS, Z  
CONTINUE  
; Read high byte  
; Read low byte  
; Read high byte  
; Sub 1st read with 2nd read  
; Is result = 0  
; Good 16-bit read  
; TMR1L may have rolled over between the read of the high and low bytes.  
; Reading the high and low bytes now will read a good value.  
MOVF  
MOVWF  
MOVF  
MOVWF  
CONTINUE  
TMR1H, W  
TMPH  
TMR1L, W  
TMPL  
; Read high byte  
; Read low byte  
; Re-enable the Interrupt (if required)  
; Continue with your code  
DS30498C-page 80  
2004 Microchip Technology Inc.  
 复制成功!