调试程序出错

2019-07-29 16:54发布

调试程序时,出现error:declaration may not appear after executable statement in block,是哪里出了错,大家遇到过这类问题吗?

上代码:void buck_mode(void)
{
     int16 count0;
     int32 SampleTable_sum1 = 0x0;
     int16 avg = 0x0;
     for(count0 = 0; count0<100; count0++)
              SampleTable_sum1 = SampleTable_sum1+Adc0_array_VL[count0];

     
     avg = SampleTable_sum1/100;
     Error =Volt_LOW_REF-avg;

U_error = A*Error+B*Error_1+C*Error_2;
duty = Kpwm*U_error;
     
     Duty_cycle = Duty_cycle_1 + duty;

   
      if(Duty_cycle>2700)
      Duty_cycle=2700;
   
      if(Duty_cycle<0)
      Duty_cycle=0;
   
      
   
       if(size1 > 1000)
      size1 = 0;
   if(size2 > 1000)
      size2 = 0;
       buff[size1++] = duty;
   buff1[size2++] = U_error;
   
      
   Duty_cycle_1 = Duty_cycle;

   Error_2 = Error_1;
   Error_1 = Error;
   Error = 0;

  
       EALLOW;
   EPwm1Regs.CMPA.half.CMPA = 0;
       EPwm4Regs.CMPA.half.CMPA = Duty_cycle;          
       EDIS;
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。