请选择 进入手机版 | 继续访问电脑版
搜索
热搜: XMC1000 XMC4000
查看: 694|回复: 0

急求!请教各路大神XC2267 定时器不准的问题???

[复制链接]

1

主题

5

帖子

27

积分

新手上路

Rank: 1

积分
27
发表于 2018-4-17 17:42:28 | 显示全部楼层 |阅读模式
本帖最后由 hushipeng123456 于 2018-4-17 17:45 编辑

刚学习XC2267M104芯片,
需要采用定时器输出一个标准的10ms中断,
采用DAvE配置软件配置定时器T3, 发现中断的时间总是Overflow加上Underflow,每10ms多了3.1ms,
求各路大神帮忙看看,如何解决???谢谢了!
下面是T3中断的初始化软件
void GPT1_vInit(void)
{
  ///  -----------------------------------------------------------------------
  ///  Configuration of Timer Block Prescaler 1:
  ///  -----------------------------------------------------------------------
  GPT12E_KSCCFG  =  0x0003;      // Module Enable
  _nop_();  // one cycle delay
  _nop_();  // one cycle delay
  
  ///  -----------------------------------------------------------------------
  ///  Configuration of the GPT1 Core Timer 3:
  ///  -----------------------------------------------------------------------
  ///  - timer 3 works in timer mode
  ///  - external up/down control is disabled
  ///  - prescaler factor is 16
  ///  - up/down control bit is reset
  ///  - alternate output function T3OUT (P7.0) is disabled
  ///  - timer 3 output toggle latch (T3OTL) is set to 0

  GPT12E_T3CON   =  0x0802;      // load timer 3 control register
  GPT12E_T3      =  0x3CB0;      // load timer 3 register
  ///  - prescaler for timer block 1 is 4
  ///  -----------------------------------------------------------------------
  ///  Configuration of the GPT1 Auxiliary Timer 2:
  ///  -----------------------------------------------------------------------
  ///  - timer 2 works in timer mode
  ///  - external up/down control is disabled
  ///  - prescaler factor is 16
  ///  - up/down control bit is reset
  ///  - timer 2 run bit is reset
  GPT12E_T2CON   =  0x0000;      // load timer 2 control register
  GPT12E_T2      =  0x0000;      // load timer 2 register
  ///  - prescaler for timer block 1 is 4
  ///  -----------------------------------------------------------------------
  ///  Configuration of the GPT1 Auxiliary Timer 4:
  ///  -----------------------------------------------------------------------
  ///  - timer 4 works in timer mode
  ///  - external up/down control is disabled
  ///  - prescaler factor is 4
  ///  - up/down control bit is reset
  ///  - timer 4 run bit is reset

  GPT12E_T4CON   =  0x0000;      // load timer 4 control register
  GPT12E_T4      =  0x0000;      // load timer 4 register
  ///  - prescaler for timer block 1 is 4
  ///  -----------------------------------------------------------------------
  ///  Configuration of the used GPT1 Port Pins:
  ///  -----------------------------------------------------------------------
  ///  Configuration of the used GPT1 Interrupts:
  ///  -----------------------------------------------------------------------
  ///  timer 3 service request node configuration:
  ///  - timer 3 interrupt priority level (ILVL) = 15
  ///  - timer 3 interrupt group level (GLVL) = 0
  ///  - timer 3 group priority extension (GPX) = 0
  GPT12E_T3IC    =  0x007C;     
  ///  Use PEC channel 4 for GPT1 T3 INT:
  ///  - normal interrupt
  ///  - pointers are not modified
  ///  - transfer a word
  ///  - service End of PEC interrrupt by a EOP interrupt node is disabled
  ///  - channel link mode is disabled
  PECC4          =  0x0000;      // load PECC4 control register
  // USER CODE BEGIN (GPT1_Function,3)
  // USER CODE END
  GPT12E_T3CON_T3R  =  1;        // set timer 3 run bit
} //  End of function GPT1_viTmr4
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|英飞凌技术社区

GMT+8, 2019-6-19 06:55 , Processed in 0.079788 second(s), 12 queries , APC On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表