实现上位机通讯,我将发送数据(54字节)打印到一个数组stm32_send_labview_data【】;然后发送至USART1,串口助手上能够显示发送数据,但是接收不到数据;注释sprintf函数后又能显示接收
// sprintf((char *)stm32_send_labview_data,"S%2d%2d%4.1f%1d%-7.2f%5d%5d%1d%1d%1d%1d%2d%1d%1d%5d%1d%1d%5d%1d%1d%1d%1d%1d%1d%1d%1d",
// dht11_temp,dht11_humi,adc_gp2y1010_out,bh1750_control,bh1750_light_05lx,bh1750_U_Limit,bh1750_D_Limit,Light_power1,Light_power2,KT_power,
// KT_module,KT_temp,window_power,runflag_window,Window_Stop_Value,curtain_power,runflag_curtain,Curtain_Stop_Value,
// mq2_power,mq2_actsign,mq9_power,mq9_actsign,rthw_power,rthw_actsign,raindrop_power,raindrop_actsign); //发送到上位机
printf("%s",stm32_send_labview_data);//发送给上位机
printf("
缓冲区:%s
",usart1_rec_buf);
[img]file:///C:Users18428DocumentsTencent Files2506078824ImageC2C 9BF51YZ]U}I(D8D[L4ZINU.png[/img]
一周热门 更多>