在线时间285 小时
UID3419421
注册时间2017-8-30
NXP金币0
该用户从未签到
高级会员

- 积分
- 750
- 最后登录
- 2021-1-25
|

楼主 |
发表于 2018-1-30 21:02:34
|
显示全部楼层
你好。晚上看了下这个延时函数发现有点问题。如果配置成翻转IO使LED闪烁
matchConfig.enableCounterReset = true;
matchConfig.enableCounterStop = false;
matchConfig.matchValue = u16delayms*12000;
matchConfig.outControl = kCTIMER_Output_Toggle;
matchConfig.outPinInitState = false;
matchConfig.enableInterrupt = false;
CTIMER_SetupMatch(DELAYCTIMER3, CTIMER_MAT_OUT, &matchConfig);
CTIMER_StartTimer(DELAYCTIMER3);不管配置成多少ms。都可以得到想要的结果。
但是如果配置成延时函数那种:
ctimer_match_config_t matchConfig;
matchConfig.enableCounterReset = true;
matchConfig.enableCounterStop = false;
matchConfig.matchValue = u16delayms*12000;
matchConfig.outControl = kCTIMER_Output_NoAction;
matchConfig.outPinInitState = false;
matchConfig.enableInterrupt = false;
CTIMER_SetupMatch(DELAYCTIMER3, CTIMER_MAT_OUT, &matchConfig);
CTIMER_StartTimer(DELAYCTIMER3);
while(DELAYCTIMER3->MCR& CTIMER_MCR_MR1R_MASK);//等待计时时间到来,时间到来定时器会复位,等待复位标志
CTIMER_StopTimer(DELAYCTIMER3);
我在主函数里只执行
PRINTF("test1\r\n");
DelayMs(1000);
PRINTF("test2\r\n");
就看不到打印test2
|
|