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

PIC16F73-I/SO 参数 Datasheet PDF下载

PIC16F73-I/SO图片预览
型号: PIC16F73-I/SO
PDF下载: 下载PDF文件 查看货源
内容描述: 40分之28引脚, 8位CMOS闪存微控制器 [28/40-pin, 8-bit CMOS FLASH Microcontrollers]
分类和应用: 闪存微控制器
文件页数/大小: 174 页 / 3853 K
品牌: MICROCHIP [ MICROCHIP TECHNOLOGY ]
 浏览型号PIC16F73-I/SO的Datasheet PDF文件第47页浏览型号PIC16F73-I/SO的Datasheet PDF文件第48页浏览型号PIC16F73-I/SO的Datasheet PDF文件第49页浏览型号PIC16F73-I/SO的Datasheet PDF文件第50页浏览型号PIC16F73-I/SO的Datasheet PDF文件第52页浏览型号PIC16F73-I/SO的Datasheet PDF文件第53页浏览型号PIC16F73-I/SO的Datasheet PDF文件第54页浏览型号PIC16F73-I/SO的Datasheet PDF文件第55页  
PIC16F7X
6.4
Timer1 Operation in
Asynchronous Counter Mode
6.4.1
READING AND WRITING TIMER1 IN
ASYNCHRONOUS COUNTER MODE
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, which will wake-up
the processor. However, special precautions in soft-
ware are needed to read/write the timer (Section 6.4.1).
In Asynchronous Counter mode, Timer1 cannot be
used as a time-base for capture or compare operations.
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.
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.
Reading the 16-bit value requires some care. The
example code provided in Example 6-1 and
Timer1 while it is running in Asynchronous mode.
EXAMPLE 6-1:
WRITING A 16-BIT FREE-RUNNING TIMER
; All interrupts are disabled
CLRF
TMR1L
; Clear Low byte, Ensures no rollover into TMR1H
MOVLW
HI_BYTE
; Value to load into TMR1H
MOVWF
TMR1H, F
; Write High byte
MOVLW
LO_BYTE
; Value to load into TMR1L
MOVWF
TMR1H, F
; Write Low byte
; Re-enable the Interrupt (if required)
CONTINUE
; Continue with your code
EXAMPLE 6-2:
READING A 16-BIT FREE-RUNNING TIMER
; All interrupts are disabled
MOVF
TMR1H, W
; Read high byte
MOVWF
TMPH
MOVF
TMR1L, W
; Read low byte
MOVWF
TMPL
MOVF
TMR1H, W
; Read high byte
SUBWF
TMPH, W
; Sub 1st read with 2nd read
BTFSC
STATUS,Z
; Is result = 0
GOTO
CONTINUE
; 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
TMR1H, W
; Read high byte
MOVWF
TMPH
MOVF
TMR1L, W
; Read low byte
MOVWF
TMPL
; Re-enable the Interrupt (if required)
CONTINUE
; Continue with your code
2002 Microchip Technology Inc.
DS30325B-page 49