《微处理方法器系统结构和嵌入式系统创新设计》chap.pptVIP

  • 0
  • 0
  • 约9.53千字
  • 约 36页
  • 2019-11-28 发布于广东
  • 举报

《微处理方法器系统结构和嵌入式系统创新设计》chap.ppt

* * 波特率设置函数 void set_speed(int fd, int speed){ int i; int status; struct termios Opt; tcgetattr(fd, Opt); /*得到机器原端口的默认设置*/ for ( i= 0; i sizeof(speed_arr) / sizeof(int); i++) { if (speed == name_arr[i]) { tcflush(fd, TCIOFLUSH); cfsetispeed(Opt, speed_arr[i]); cfsetospeed(Opt, speed_arr[i]); status = tcsetattr(fd, TCSANOW, Opt); if (status != 0) { perror(tcsetattr fd1); return; } tcflush(fd,TCIOFLUSH); } } } * * 数据格式设置函数 int set_Parity(int fd,int databits,int stopbits,int parity) { struct termios options; if ( tcgetattr( fd,options) != 0) { perr

文档评论(0)

1亿VIP精品文档

相关文档