当前位置: 技术问答>linux和unix
在linux下用串口发送数据问题:
来源: 互联网 发布时间:2016-02-14
本文导语: 在linux下用如下程序通过串口发送数据 char sendbuffer[66]; if(nwrite = write(fd, sendbuffer,64))>0) { printf("send data to uart success! nwrite = %dn",nwrite); } else { printf("nsend data to uart fail!n"); } 当sendbuffer[]中含有数据 0 ...
在linux下用如下程序通过串口发送数据
char sendbuffer[66];
if(nwrite = write(fd, sendbuffer,64))>0)
{
printf("send data to uart success! nwrite = %dn",nwrite);
}
else
{
printf("nsend data to uart fail!n");
}
当sendbuffer[]中含有数据 0 时,会出现发送失败的问题,即nwrite
char sendbuffer[66];
if(nwrite = write(fd, sendbuffer,64))>0)
{
printf("send data to uart success! nwrite = %dn",nwrite);
}
else
{
printf("nsend data to uart fail!n");
}
当sendbuffer[]中含有数据 0 时,会出现发送失败的问题,即nwrite