linux串口通讯
linux串口通讯
linux串口通讯的步骤图
1.打开串口
//打开串口
int open_port(void)
{
int fd;
fd=open("/dev/ttyUSB0",O_RDWR | O_NOCTTY | O_NONBLOCK);//O_NONBLOCK设置为非阻塞模式,在read时不会阻塞住,在读的时候将read放在while循环中,下一节篇文档将详细讲解阻塞和非阻塞
// printf("fd=%d\n",fd);
if(fd==-1)
{
perror("Can
原创
2021-03-29 10:02:00 ·
386 阅读 ·
0 评论