主题中讨论的其他器件:HALCOGEN
工具/软件:Code Composer Studio
您好、TI、
有人能不能帮助我如何在 Hercules TMS570LC43x Launchpad 的两个 CAN 信号之间提供一秒的延迟。
在使用 Halcogen 时、没有提供周期时间的选项、而在使用中断时、它也不起作用。
如果有人可以给我一段使用中断的代码、让 CAN 信号间隔一秒、那就很好了。
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
您好、TI、
有人能不能帮助我如何在 Hercules TMS570LC43x Launchpad 的两个 CAN 信号之间提供一秒的延迟。
在使用 Halcogen 时、没有提供周期时间的选项、而在使用中断时、它也不起作用。
如果有人可以给我一段使用中断的代码、让 CAN 信号间隔一秒、那就很好了。
以下是使用 RTI 计时器生成延迟的示例:
#define TIMER_LOAD_VAL 0xFFFF
#define READ_TIMER (0xFFFFFFFF -*(易失性 ulong *)(0xFFFFFF00 + 0x10)
#define CFG_Hz (以 Hz 为单位的 vclk)/*例如80000000 (80MHz),*/
//usec 为微秒、TMO 为时钟周期
空延迟(unsigned int usec)
{
无符号 int tmo、tmp;
if (usec >= 1000){
TMO = usec/1000;
TMO *= CFG_Hz;
TMO /= 1000;
}否则{
TMO = usec * CFG_Hz;
TMO /=(1000*1000);
}
tmp = get_timer_masked_masked(); /*获取当前时间戳*/
if ((TMO + tmp + 1)< tmp){
lastdec = read_timer;
时间戳= 0;
}
其他
TMO += tmp;
while (get_timer_masked_masked ()< TMO) /*循环至事件*/
}
Ulong get_timer_masked (空)
{
unsigned int now = read_timer; //当前节拍值*/
if (lastdec >= now){
/*正常模式*/
timestamp += lastdec -现在;
}否则{
TIMESTAMP+= lastdec + timer_load_VAL -现在;
}
lastdec =现在;
返回时间戳;
}