首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >计算modbus RTU 3.5字符时间

计算modbus RTU 3.5字符时间
EN

Stack Overflow用户
提问于 2013-12-23 16:53:46
回答 2查看 20.2K关注 0票数 11

我是Modbus新手,正在使用Modbus RTU开发应用程序。我想知道如何知道RTU消息帧分离时间。在Modbus RTU规范中,它提到了3.5个字符的时间,但是没有更多关于我如何确定这个间隔的数据。计算分离时间的步骤是什么?

EN

回答 2

Stack Overflow用户

发布于 2014-01-20 06:41:00

请看Modbus Serial Line Protocol and Implementation Guide V1.02的第13页

在底部,您可以找到一个注释,用于解释字符间超时(t1.5)和帧间延迟(t3.5)值。

对于超过19200的波特率,值是固定的。对于较慢的波特率,需要计算它们(摘自Arduino的SimpleModbusMaster库):

代码语言:javascript
运行
复制
// Modbus states that a baud rate higher than 19200 must use a fixed 750 us 
// for inter character time out and 1.75 ms for a frame delay.
// For baud rates below 19200 the timeing is more critical and has to be calculated.
// E.g. 9600 baud in a 10 bit packet is 960 characters per second
// In milliseconds this will be 960characters per 1000ms. So for 1 character
// 1000ms/960characters is 1.04167ms per character and finaly modbus states an
// intercharacter must be 1.5T or 1.5 times longer than a normal character and thus
// 1.5T = 1.04167ms * 1.5 = 1.5625ms. A frame delay is 3.5T.    

if (baud > 19200)
{
    T1_5 = 750; 
    T3_5 = 1750; 
}
else 
{
    T1_5 = 15000000/baud; 
    T3_5 = 35000000/baud; 
}
票数 17
EN

Stack Overflow用户

发布于 2017-07-04 18:57:22

Modbus RTU使用11位字符,无论是否使用奇偶校验。对于一个字符时间,公式应为: 11 * 1000000 /( baud_rate ),这适用于波特率<= 19200 bps。当波特率> 19200 bps时,使用固定时间,其中3.5char时间为1750µs,1.5char时间为750µs

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20740012

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档