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.

程序跑飞



设置DSP  GPIO口接收一个传感模块的数据,单步调试发现PC指向该函数头,具体程序设计如下:

void Read_HuMi(void)
{
   Uint16 i,check_sum;
 Uint16 data2,data3;
 Uint16 temp1=0x00,temp2=0x00,temp3=0x00,temp4=0x00,ch_sum=0x00;
   
 int64   Humi_data = 0x00;

    DisTimInt();    //禁止中断
 DELAY_US(10);

 EALLOW;
 IOOUT();
 EDIS;

 IOClr();
 DELAY_US(180);

 EALLOW;
 IOINPUT();              //设置GPIOD5 为输出
 EDIS;

 while(GpioDataRegs.GPDDAT.bit.GPIOD5 == 0)  { DELAY_US(1);  }     //等待输入为高电平
  
    for(i=0;i<40;i++)       //读出40位数据
 {
    
     while(GpioDataRegs.GPDDAT.bit.GPIOD5 == 1)  { DELAY_US(1); }  //等待输入为低
       
    while(GpioDataRegs.GPDDAT.bit.GPIOD5 == 0)  { DELAY_US(1); }  //等待输入为高

  DELAY_US(40);       //延时40us

  if(IOData)
      Humi_data |= 0x01;
  Humi_data <<= 1;
  } 

}

在添加这段语句时 “while(GpioDataRegs.GPDDAT.bit.GPIOD5 == 1)  { DELAY_US(1); }  //等待输入为低”就会造成上述现象,修改了堆栈stack的大小还是有这个出现,请问我的这段代码问题出在哪里?  谢谢