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.

从机添加延时函数的问题



在从机程序中任务函数添加延时函数,会出现导致mcu挂起的情况,请问如果某个程序需要等待一段延时,怎么在从机程序中添加这个延时呢?以下是个程序例子(在任务函数中调用):

char GetData(void)

{

 char a ;

    senddata();//调用子函数

   delay(1000);//延时等待

if(a==1)

{

  return 0;

}

return 1;

}