请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TMS320F2800137 您好!
客户对 SYSCTL.c 中的示例代码有疑问:
do
{
//
// Keep clearing the counter until it is no longer saturated
//
while(HWREG(CLKCFG_BASE + SYSCTL_O_X1CNT) > 0x1FFU)
{
HWREG(CLKCFG_BASE + SYSCTL_O_X1CNT) |= SYSCTL_X1CNT_CLR;
}
//
// Wait for the X1 clock to saturate
//
while(HWREGH(CLKCFG_BASE + SYSCTL_O_X1CNT) != SYSCTL_X1CNT_X1CNT_M)
{
//
// If your application is stuck in this loop, please check if the
// input clock source is valid.
//
localCounter++;
if(localCounter>2500000)
{
if(loopCount == 3U)
status = false;
break;
}
}
if(loopCount == 3U &&
(HWREGH(CLKCFG_BASE + SYSCTL_O_X1CNT) == SYSCTL_X1CNT_X1CNT_M))
{
status = true;
}
//
// Increment the counter
//
loopCount++;
localCounter = 0U;
}while(loopCount < 4U);
为什么选择值0x1FFU 来清除计数器? 是否有任何特殊原因、或者是否可以使用其他值?
此致、Holger
