- 1、本文档共50页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
PIC的TIMER2、ccp模块
8.3 TIMER2 模块(TIMER2 MODULE) TIMER2概述 Timer2 is an 8-bit timer with a prescaler and a postscaler(后分频). It can be used as the PWM time base for the PWM mode of the CCP module(s). The TMR2 (地址11h)register is readable and writable and is cleared on any device Reset. 8.3.1 TIMER2的原理框图 The input clock (FOSC/4) has a prescale option of 1:1, 1:4 or 1:16, selected by control bits T2CKPS1:T2CKPS0 (T2CON1:0). The Timer2 module has an 8-bit period register, PR2. Timer2 increments from 00h until it matches PR2 and then resets to 00h on the next increment cycle. PR2 is a readable and writable register. The PR2 register is initialized to FFh upon Reset. The match output of TMR2 goes through a 4-bit postscaler (which gives a 1:1 to 1:16 scaling inclusive) to generate a TMR2 interrupt (latched in flag bit,TMR2IF (PIR11)). Timer2 can be shut-off by clearing control bit, TMR2ON (T2CON2), to minimize power consumption. 8.3.2 the Timer2 Control register bit 7 Unimplemented: Read as ‘0’ bit 6-3 TOUTPS3:TOUTPS0: Timer2 Output Postscale Select bits 0000 = 1:1 postscale 0001 = 1:2 postscale 0010 = 1:3 postscale;… … 1111 = 1:16 postscale bit 2 TMR2ON: Timer2 On bit 1 = Timer2 is on 0 = Timer2 is off bit 1-0 T2CKPS1:T2CKPS0: Timer2 Clock Prescale Select bits 00 = Prescaler is 1 01 = Prescaler is 4 1x = Prescaler is 16 8.3.3 Timer2 Prescaler and Postscaler The prescaler and postscaler counters are cleared when any of the following occurs: ? a write to the TMR2 register ? a write to the T2CON register ? any device Reset (POR, MCLR Reset, WDT Reset or BOR) TMR2 is not cleared when T2CON is written. 8.3.4 Output of TMR2 The output of TMR2 (before the postscaler) is fed to the SSP module, which optionally uses it to generate the shift clock. 8.3.5与TIMER2有关的REGISTERS 第11章CAPTURE/COMPARE/PWMMODULES 11.1 原理概述 Each Capture/Compare/PWM (CCP) module contains a 16-bit register which can operate as a: ? 16-bit Capture register ? 16-bit Compare register ? PWM Master/Slave Duty Cycle reg
文档评论(0)