首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

终端I/O---ttyS3: 3 inp

#include <stdio.h> #include "time.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <termios.h> int main() {   struct termios opt;   int fd=-1;   int nread;   char buf[1024];   fd=open("/dev/ttyS3" ,O_RDONLY    |O_NONBLOCK); if(fd==-1)    {    printf("open /dev/ttyS3 error\n");    }   tcgetattr(fd,&opt);              //获取终端属性到opt   tcflush(fd,TCIOFLUSH);              //同时刷新收到的数据但是不读,刷新写入的数据但是不传送   cfsetispeed(&opt, B9600);                 //设置输入波特率   cfsetospeed(&opt, B9600);             //设置输出波特率   opt.c_cflag&=~CSIZE;              //(不用     )字符长度掩码。取值为 CS5, CS6, CS7, 或 CS8。   opt.c_cflag |=CS8;              //取值为CS8   opt.c_cflag &= ~PARENB;              //(不用     )允许输出产生奇偶信息以及输入的奇偶校验。   opt.c_iflag &= ~INPCK;              //(不用     )启用输入奇偶检测。   opt.c_cflag &= ~CSTOPB;              //(不用     )设置两个停止位,而不是一个   opt.c_cflag &= ~CRTSCTS;              //(不用     )硬件流控   opt.c_cc[VTIME] = 150;              //非 canonical 模式读时的延时,以十分之一秒为单位   opt.c_cc[VMIN] = 0;                      //非 canonical 模式读的最小字符数   opt.c_lflag    &= ~(ICANON | ECHO) ;              //(不用     )启用标准模式 (canonical mode)允许使用              //特殊字符 EOF, EOL, EOL2, ERASE, KILL, LNEXT, REPRINT,               //和 WERASE,以及按行的缓冲。              //(不用     )回显输入字符。   tcflush(fd,TCIOFLUSH);   tcsetattr(fd,TCSANOW,&opt);              //改变立即发生 while(1)     {         nread = read(fd,buf,1000);         //printf("nread=%d\n",nread);         //if(nread !=-1 )    printf("%s",buf);//打印数据         sleep(2);         memset(buf,0x0,1024);     } if(fd!=-1) close(fd);   return 0; }

01
您找到你想要的搜索结果了吗?
是的
没有找到

项目keyword解释

--------Work Package ------ A work package is a portion of the work breakdown structure that allows project management to define the steps necessary for completion of the work package. A work package can be thought of as a mini project, that when combined with other work package units, form the completed project. An individual work package contains essential steps involved in completion of the work package along with a deadline by which each of the steps must be completed in order for project management to stay on track. A work package may in itself be thought of as a deliverable. Work packages allow for simultaneous work on many different components of a project at the same time by multiple teams. Each team follows the steps defined in the work package and completes them by the specified deadline. When all teams have finished their individual work packages, the whole project comes together with seamless integration. Completion of a work package is most often overseen by a specific person whether it is a manager, supervisor, team leader, or a designated team member. A work package is usually the bottom tier of the project management process.

01
领券