串口通信(tōng xìn)实验
2、串口设置函数(hánshù)
串口通讯里 termios.h 是个很重要的头文件。
分别使用 tcgetattr()和 tcsetattr()函数(hánshù)
可以获取核设置串口属性。
tcgetattr (int __fd, struct termios
*__termios_p)
tcsetattr (int __fd, int __optional_actions,
__const struct termios *__termios_p) 其中
termios 是结构 termios 形式的数据结构,用
于存放串口属性:
struct termios {
tcflag_t c_iflag; /* 输入模式标志 */
tcflag_t c_oflag; /* 输出模式标志 */
tcflag_t c_cflag; /* 控制模式标志 */
tcflag_t c_lflag; /* 本地模式标志 */
cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* 控制特性 */
speed_t c_ispeed; /* 输入速度 */
speed_t c_ospeed; /* 输出速度 */
}
第四页,共41页。
4
评论0
最新资源