rs485 接收 方式
changpan1110 opened this issue · comments
changpan1110 commented
为啥不把RS485 串口接收方式改成 断帧方式 接收呢?
串口接收后 启动定时器,只要超过一定时间后,才认为一帧接收完成了?
这样是否可以呢?
齐永忠 commented
RS485支持自动分帧,参数“字节超时”就是用于此用目的的。
齐永忠
电话:15810366850
北京国电通网络技术有限公司
北京市北京市昌平区陈家营西路4号院1号楼 嘉铭奥森产业园西塔6层
邮政编码:100000
发件人: changpan1110
发送时间: 2024-02-26 03:05
收件人: qiyongzhong0/rt-thread-rs485
抄送: Subscribed
主题: [qiyongzhong0/rt-thread-rs485] rs485 接收 方式 (Issue #6)
为啥不把RS485 串口接收方式改成 断帧方式 接收呢?
串口接收后 启动定时器,只要超过一定时间后,才认为一帧接收完成了?
这样是否可以呢?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
changpan1110 commented
我没有找到 RS485支持自动分帧 这个地方。 代码下来的就是 断帧的话,也会接收完成的!
齐永忠 commented
rs485_recv和rs485_send_then_recv函数中,当无数据可读时会等待串口中断事件,已收到过数据则等待超时时间为字节间隔,未收到过数据则等待超时时间为应答超时。这里的字节间隔超时就有自动分帧的作用。在问答式通信中,主机发送命令然后等待从机应答;从机接收数据时,可通过字节间隔超时作为判据,认为命令帧已结束。
发件人: changpan1110
发送时间: 2024-03-28 10:20
收件人: qiyongzhong0/rt-thread-rs485
抄送: 齐永忠; Comment
主题: Re: [qiyongzhong0/rt-thread-rs485] rs485 接收 方式 (Issue #6)
我没有找到 RS485支持自动分帧 这个地方。 代码下来的就是 断帧的话,也会接收完成的!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
changpan1110 commented
rs485_break_recv 你说的是这个把? 我把源码看完后,就发现 只有一个事件/信号量的超时,没有发现有其他得!
齐永忠 commented
发件人: changpan1110
发送时间: 2024-03-28 10:20
收件人: qiyongzhong0/rt-thread-rs485
抄送: 齐永忠; Comment
主题: Re: [qiyongzhong0/rt-thread-rs485] rs485 接收 方式 (Issue #6)
我没有找到 RS485支持自动分帧 这个地方。 代码下来的就是 断帧的话,也会接收完成的!
―
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
changpan1110 commented
rs485_break_recv 你说的是这个把? 我把源码看完后,就发现 只有一个事件/信号量的超时,没有发现有其他得!
蒙蒙plus commented
rs485_break_recv 你说的是这个把? 我把源码看完后,就发现 只有一个事件/信号量的超时,没有发现有其他得!
你是想要这两个吧
rs485_set_recv_tmo(hinst, 100); /!< 等待延迟 超时则认为没有数据 /
rs485_set_byte_tmo(hinst, 5); /!< 帧间隔 字节超时,收到数据后,后续超时没有新数据过来则认为一帧/
齐永忠 commented