11章ccp模块.ppt

  1. 1、本文档共31页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
11章ccp模块

第11章CAPTURE/COMPARE/PWM MODULES 11.1 CCP模块基本功能 每个 Capture/Compare/PWM (CCP) 模块包含1个16位寄存器,可作为 ? 捕捉寄存器(Capture register) ? 比较寄存器(Compare register) ? PWM 占空比寄存器(Duty Cycle register) CCP1和CCP2模块是相同,区别仅在于特殊的事件触发。 CCP模块时钟源搭配右表所示: 11.2 CCP模块寄存器、控制寄存器 CCP模块寄存器CCPR CCP1模块--CCPR1H(16h)、CCPR1L(15h) 特殊事件触发功能:由比较匹配信号产生,并使TMR1复位。 CCP2模块--CCPR2H(1Ch)、CCPR2L(1Bh) 特殊事件触发功能:由比较匹配信号产生,并使TMR1复位,可启动A/D转换。 CCP控制寄存器CCPCON CCP1模块--CCPCON1(17h) CCP2模块--CCPCON2(1Dh) bit 3-0 CCPxM3:CCPxM0: CCPx Mode Select bits 0000 = Capture/Compare/PWM disabled (resets CCPx module) 0100 = Capture mode, every falling edge 0101 = Capture mode, every rising edge 0110 = Capture mode, every 4th rising edge 0111 = Capture mode, every 16th rising edge 1000 = Compare mode, set output (CCPX PIN) on match (CCPxIF bit is set) 1001 = Compare mode, clear output (CCPX PIN )on match (CCPxIF bit is set) 1010 = Compare mode, generate software interrupt on match (CCPxIF bit is set, CCPx pin is unaffected) 1011 = Compare mode, trigger special event (CCPxIF bit is set, CCPx pin is unaffected); CCP1 resets TMR1; CCP2 resets TMR1 and starts an A/D conversion (if A/D module is enabled) 11xx = PWM mode bit 5-4 CCPxX:CCPxY: PWM Least Significant bits Capture mode:Unused. Compare mode:Unused. PWM mode:These bits are the two LSbs of the PWM duty cycle. The eight MSbs are found in CCPRxL. 11.3 Capture Mode In Capture mode, CCPR1H:CCPR1L captures the 16-bit value of the TMR1 register when an event occurs on pin RC2/CCP1. An event is defined as one of the following: ? Every falling edge ? Every rising edge ? Every 4th rising edge ? Every 16th rising edge The type of event is configured by control bits, CCP1M3:CCP1M0 (CCPxCON3:0). When a capture is made, the interrupt request flag bit, CCP1IF (PIR12), is set. The interrupt flag must be cleared in software. If another capture occurs before the value in register CCPR1 is read, the old captured value is overwritten by the new value. 11.3.1 CCP PIN CONFIGURATION In Capture mode, the RC2/C

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档