在线时间0 小时
UID47308
注册时间2008-5-12
NXP金币0
该用户从未签到
新手上路

- 积分
- 49
- 最后登录
- 1970-1-1
|
发表于 2013-4-16 23:31:10
|
显示全部楼层
回复:Kinetis芯片常见技术问题(不断更新中...)
<div style="padding:5px;border:1px dashed #ccc;">回复第 15 楼 于2013-04-16 21:26:13发表:
回复第 13 楼 于2013-04-16 16:47:13发表:
回复第 6 楼 于2013-04-15 22:14:34发表:
=======================计时器模块==========================
希望定时器使能后能够在指定条件下禁止,我使用了如下语句:
... ...
PIT->CHANNEL[3].TCTRL|=(PIT_TCTRL_TEN_MASK|PIT_TCTRL_TIE_MASK);//使能定时器及中断
... ...
if(条件1)
{
PIT->CHANNEL[3].TCTRL&=~(PIT_TCTRL_TEN_MASK|PIT_TCTRL_TIE_MASK);//禁止定时器及中断
}
貌似上面无法在‘条件1’ 下禁止定时器(测试过条件1为真时,程序已经进入该语句),这样不对吗?谢谢!
我自己做了个小的测试程序,使用如下语句是可以关闭PIT 计时器的。
PIT_TCTRL0 &= ~(PIT_TCTRL_TEN_MASK|PIT_TCTRL_TIE_MASK);
具体信息请参考附件中的代码。
测试平台: TWR-K40X256 板子, 芯片PK40 100MHz, mask set: 0M33Z。
由于0M33Z芯片PIT模块有一个bug,所以在中断服务程序中,需要在清掉中断标志时,再次读取PIT某个寄存器。
PIT中断服务程序如下:
/*
** ###################################################################
**
** The interrupt service routine(s) must be implemented
** by user in one of the following user modules.
**
** If the "Generate ISR" option is enabled, Processor Expert generates
** ISR templates in the CPU event module.
**
** User modules:
** ProcessorExpert.c
** Events.c
**
** ###################################################################*/
PE_ISR(pit0_isr)
{
// NOTE: The routine should include actions to clear the appropriate
// interrupt flags.
int temp;
PIT_TFLG0 |= PIT_TFLG_TIF_MASK;
temp = PIT_TCTRL0;
GPIOC_PTOR |= (0x1 |
-
-
PIT.ppt
193.5 KB, 下载次数: 14, 下载积分: 威望 1
|