大家好
在sys/bios里 只有一个任务:
Void Uart6657Send()
{
uint8_t i=0;
for(;;)
{
for(i=0;i<10;i++)
{
//程序
}
Task_sleep(20);
}
}
Task_sleep(20)表示这个任务休眠20ms 再执行 这样的话 两次发送的间隔应该是20ms
但测量发现 两次发送的间隔小于20ms 这是什么问题啊???
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.
大家好
在sys/bios里 只有一个任务:
Void Uart6657Send()
{
uint8_t i=0;
for(;;)
{
for(i=0;i<10;i++)
{
//程序
}
Task_sleep(20);
}
}
Task_sleep(20)表示这个任务休眠20ms 再执行 这样的话 两次发送的间隔应该是20ms
但测量发现 两次发送的间隔小于20ms 这是什么问题啊???
请问您是通过GPIO管脚来量的?这个不是很准。
建议用TSCL, TSCH来测代码运行时间。
void main() {
unsigned long long t1, t2;
...
TSCL = 0; // Initiate CPU timer by writing any val to TSCL
...
t1 = _itoll( TSCH, TSCL ); // benchmark snapshot of free-running ctr
my_code_to_benchmark();
t2 = _itoll( TSCH, TSCL ); // benchmark snapshot of free-running ctr
printf("# cycles == %ld\n", (t2-t1));
}