This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具/软件:Code Composer Studio
大家好,自从4年以来,我们使用了真正有用的源文件来配置C2000硬件。
例如 计时器配置,此处为源代码(见下文),它随多种工具(如controlSUITE)一起提供。
我想知道,这一行是否正确,以获得确切的期望时间:
温度=(长)(频率*周期);
是否有可能,一个周期的差异?
正确的代码必须是:
温度=(长)(频率*周期)-1;
????
BR Ralf
void ConfigCpuTimer(struct CPUTIME_VARS *Timer,float Freq,float period)
{
UINT32 温度;
//初始化计时器周期:
Timer->CPUFreqInMHz =频率;
Timer->PeriodInUSec =周期;
温度=(长)(频率*周期);
Timer->RegsAddr->PRD.All =临时;
//将预刻度计数器设为除以1 (SYSCLKOUT):
Timer->RegsAddr->TPR.All =0;
Timer->RegsAddr->Thp.all = 0;
//初始化定时器控制寄存器:
Timer->RegsAddr->TCR.bit.tss=1;//1= 停止计时器,0=启动/重新启动计时器
Timer->RegsAddr->tcr.bit.trb =1;// 1=重新加载计时器
Timer->RegsAddr->tcr.bit.soft =1;
Timer->RegsAddr->tcr.bit.free =1;// 计时器空闲运行
Timer->RegsAddr->TCR.bit.tie =1;// 0=禁用/1=启用计时器中断
//重置中断计数器:
Timer-> InterruptCount = 0;
}
您好,Santosh:
感谢您提供信息,此问题已解决。
BR Ralf