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.
/*--------------全局变量定义----------------------------------------------------*/
Uint16 tcount,icount,rccount,itemp;
CTRL ctrlcla;
CLA_CALIB cla_calib;
Uint16 Channel_num;
/*--------------宏设置定义------------------------------------------------------*/
/*-------------内部函数声明-----------------------------------------------------*/
/*不能使用函数指针,不能进行<>比较,采用=、!=*/
__interrupt void Cla1Task1 ( void )
{
Uint16 i,num;
num = Channel_num;
rccount++;
GpioDataRegs.GPBSET.bit.GPIO33 = 1;
/*9-16通道控制*/
for(i=0;i!=num;i++)
{
CTRL_Run_exe(&ctrlcla.Channel[i],i+8,cla_para.Period,cla_para.Test_flag);
}
GpioDataRegs.GPBCLEAR.bit.GPIO33 = 1;
}
在back任务中Channel_num被赋值8,然后在任务中将值赋值给num,整个程序运行时间会比直接将num=8多花费一倍时间
你好,CLA其实本身就不适合处理逻辑性的语句,而更适合处理计算类的,所以这个情况是必然会发生的。唯一的办法就是将这类代码放在CPU中运行,而CLA专注于运算方面的处理。