PIC17C752 Datasheet

  • PIC17C752

  • High-Performance 8-bit CMOS EPROM Microcontrollers with 10-b...

  • 3053.02KB

  • 304页

  • Microchip   Microchip

扫码查看芯片数据手册

上传产品规格书

PDF预览

PIC17C75X
12.3
Read/Write Consideration for TMR0
12.3.2
WRITING A 16-BIT VALUE TO TMR0
Although TMR0 is a 16-bit timer/counter, only 8-bits at
a time can be read or written during a single instruction
cycle. Care must be taken during any read or write.
12.3.1
READING 16-BIT VALUE
Since writing to either TMR0L or TMR0H will effectively
inhibit increment of that half of the TMR0 in the next
cycle (following write), but not inhibit increment of the
other half, the user must write to TMR0L 铿乺st and
TMR0H second in two consecutive instructions, as
shown in Example 12-2. The interrupt must be dis-
abled. Any write to either TMR0L or TMR0H clears the
prescaler.
The problem in reading the entire 16-bit value is that
after reading the low (or high) byte, its value may
change from FFh to 00h.
Example 12-1 shows a 16-bit read. To ensure a proper
read, interrupts must be disabled during this routine.
EXAMPLE 12-2: 16-BIT WRITE
BSF
MOVFP
MOVFP
BCF
CPUSTA, GLINTD
RAM_L, TMR0L
RAM_H, TMR0H
CPUSTA, GLINTD
; Disable interrupts
;
;
; Done, enable
;
interrupts
EXAMPLE 12-1: 16-BIT READ
MOVPF
MOVPF
MOVFP
CPFSLT
RETURN
MOVPF
MOVPF
RETURN
TMR0L, TMPLO
TMR0H, TMPHI
TMPLO, WREG
TMR0L
TMR0L, TMPLO
TMR0H, TMPHI
;read low tmr0
;read high tmr0
;tmplo
鈭?gt;
wreg
;tmr0l < wreg?
;no then return
;read low tmr0
;read high tmr0
;return
12.4
Prescaler Assignments
Timer0 has an 8-bit prescaler. The prescaler assign-
ment is fully under software control; i.e., it can be
changed 鈥渙n the 铿倅鈥?during program execution. When
changing the prescaler assignment, clearing the pres-
caler is recommended before changing assignment.
The value of the prescaler is 鈥渦nknown,鈥?and assigning
a value that is less then the present value makes it dif-
铿乧ult to take this unknown time into account.
FIGURE 12-4: TMR0 TIMING: WRITE HIGH OR LOW BYTE
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
AD15:AD0
PC
PC+1
PC+2
PC+3
PC+4
ALE
T0
T0+1
New T0 (NT0)
New T0+1
TMR0L
Fetch
Instruction
executed
TMR0H
MOVFP W,TMR0L MOVFP TMR0L,W MOVFP TMR0L,W MOVFP TMR0L,W
Write to TMR0L
Read TMR0L
Read TMR0L
Read TMR0L
(Value = NT0)
(Value = NT0)
(Value = NT0 +1)
1997 Microchip Technology Inc.
Preliminary
DS30264A-page 89

PIC17C752相关型号PDF文件下载

您可能感兴趣的PDF文件资料

热门IC型号推荐

扫码下载APP,
一键连接广大的电子世界。

在线人工客服

买家服务:
卖家服务:

0571-85317607

客服在线时间周一至周五
9:00-17:30

关注官方微信号,
第一时间获取资讯。

建议反馈
返回顶部

建议反馈

联系人:

联系方式:

按住滑块,拖拽到最右边
>>
感谢您向阿库提出的宝贵意见,您的参与是维库提升服务的动力!意见一经采纳,将有感恩红包奉上哦!