常驻嘉宾
猫爸爸
- 积分
- 3602
- 威望
- 1062
- 贡献
- 1380
- 兑换币
- 318
- 注册时间
- 2009-12-11
- 在线时间
- 580 小时
|
本帖最后由 cat888 于 2010-5-31 08:05 编辑
这是我的初始化代码:
- void PAInit(void)
- {
- DisableInterrupts; //禁止中断
-
- TSCR1_TFFCA=1; //快速清除flag:PAOVF PAIF
-
- /* DATASHEET P472
- * To operate the 16-bit pulse accumulator independently of input capture or output compare 7 and 0
- * respectively the user must set the corresponding bits IOSx = 1, OMx = 0 and OLx = 0. OC7M7 in the
- * OC7M register must also be cleared.
- */
- TIOS_IOS7=1; //单独使用16位脉冲累加器
- OC7M_OC7M7=0;; //注意此时必须令IOS7=1,OC7M7=0,OM7=0,OL7=0
- TCTL1_OM7=0;
- TCTL1_OL7=0;
-
- PACTL_PAMOD=0; //事件计数方式
- //PACTL_PEDGE=1; //PT7引脚上的出现上升沿时脉冲累加器计数器加1
- //PACTL_PAOVI=1; //允许脉冲累加器产生溢出时引发中断
- //PACTL_PAI=1; //允许PT7引脚上出现上升沿时引发中断
- PACTL_PAEN=1; //启动脉冲累加器A
- PACNT = 0x0000;
-
- }
复制代码 |
|