这是我的C程序(在Linux中)的相关部分:
while (input != ' '){
write(serial_port, msg, sizeof(msg));
//1. here I would like to wait at least 100 us with the Tx line high
//2. followed by at least 8us with the Tx line low
//3. and then repeat the message
input = mygetch();
}如您所见,每次通过串口发送msg后,我希望将Tx行设置为100微秒,然后低设置8微秒,然后重复该消息,直到用户按下空格键。
在Linux中使用C在串口上有这种控件吗?
蒂娅谢谢你的帮助。
发布于 2022-04-26 10:11:28
是。当不发送任何数据时,串行行的默认状态是“标记”(对于单结束行来说是高的)。若要发送空格(低),请设置中断位。清除中断位以恢复空闲状态。
正如注释中指出的,to设备ioctls TIOCSBRK和TIOCCBRK可用于发送和清除中断。
https://stackoverflow.com/questions/72012002
复制相似问题