CC3200 Timer定时器操作
CC3200 每个Timer定时器包含两个16位计数器,请问我在使用时,是否可以将两个16位计数器分开使用?初始化、配置等操作是相同的么?如果我Enable一个16位计数器,另外一个不用的话要怎么配置呢?或者请问是否有例程资料可以参考呢?感谢~~
在http://www.ti.com/lit/ug/swru367c/swru367c.pdf的1.3.4章:
1.3.4 General Purpose Timer (GPT) The CC3200 includes 4 instances of 32-bit user-programmable general purpose timers. GPTs count or time external events that drive the timer input pins. Each GPT module (GPTM) block provides two 16-bit timers or counters that can be configured to operate independently as timers or event counters, or configured to operate as one 32-bit timer.
用是可以分开用的,不过SDK里面没有提供相应的用法。建议你还是照SDK的方法,如果你只想用其中的一个,参考一下下面的代码:
if(ulTimer == TIMER_BOTH)
{
MAP_TimerIntEnable(ulBase, TIMER_TIMA_TIMEOUT|TIMER_TIMB_TIMEOUT);
}
else
{
MAP_TimerIntEnable(ulBase, ((ulTimer == TIMER_A) ? TIMER_TIMA_TIMEOUT :
TIMER_TIMB_TIMEOUT));