单片机却无限次的传输给PC

2019-07-17 13:31发布

单片机串口传输到PC,设置执行40次,但是单片机却无限次的传输给PC,希望有谁能解释一下。程序如下:
for(k=0;k<N;k++)
{
while(!con_end);
EA = 0; // 关中断
AD0INT=0;
temp= ADC0;
temp &= 0x000fff;
// EA = 1; //开中断
temperature = temp*100L*3/1024;
temp_int = temperature/100;
temp_frac = temperature - (temp_int * 100);
// for(x=0;x<4000;x++);

// for(x=0;x<4000;x++);
printf ("V_input is %02d.%02dV ", temp_int, temp_frac);
TMR3CN |= 0x04;
EA = 1;
con_end=0;
// AMX0P=0x0c;
// AD0EN=0;
}
我在佛for循环后面添加了while语句,就不能传输给PC机了。又是为何?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。