串口初始化
来源:互联网 发布:python创建元组 编辑:程序博客网 时间:2024/05/22 08:23
int ComInit(unsigned char ComID,unsigned int Boudrate)
{
int status;
struct termios options;
tcflush(ComID,TCIOFLUSH);tcgetattr(ComID, &options);switch(Boudrate){ case 9600: options.c_cflag = B9600|CS8|CLOCAL|CREAD; break; case 115200: options.c_cflag = B115200|CS8|CLOCAL|CREAD; break; case 230400: options.c_cflag = B230400|CS8|CLOCAL|CREAD; break; break;}options.c_iflag = IGNPAR;options.c_lflag = 0;options.c_oflag = 0;options.c_cc[VTIME]=3; options.c_cc[VMIN] =200;status = tcsetattr(ComID,TCSANOW,&options);if(status!=0) { close(ComID); printf("uart init ERR_DEVICE"); return -1; } tcflush(ComID,TCIOFLUSH); return 0;
}
阅读全文
0 0
- 串口初始化
- 串口初始化
- 串口初始化
- 串口初始化
- s3c6410 串口初始化
- linux串口驱动初始化
- uboot 串口初始化
- STM32---串口初始化
- uboot串口初始化
- iOS--串口通讯初始化
- 串口初始化配置
- Linux 串口终端初始化
- 串口通信初始化
- linux串口驱动初始化
- linux串口驱动初始化
- mscomm串口控件初始化
- 串口驱动分析-初始化
- stm32初始化三个串口
- switch使用小结,大神勿喷
- mongodb DataBase与Collection
- FIFO控制程序
- 线程池(通俗易懂)
- sql语句查询语法
- 串口初始化
- 本地远程连接 liunx mysqlservice
- Qt之显示yuv数据图像
- 你的第一个中断程序!
- liunx:Shell 常用通配符:
- 串口服务器的理解---百度知道
- 用命令行自动生成mavn工程
- Makefile中echo -e 以及 输出$()和%.o 这两个字符串的问题
- log4net 自定义level