计算Modbus RTU 3.5个字符的时间 [英] Calculating modbus RTU 3.5 character time

查看:529
本文介绍了计算Modbus RTU 3.5个字符的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是Modbus的新功能,并使用Modbus RTU开发应用程序.我想知道如何找出RTU消息帧分离时间.在Modbus RTU规范中,它提到3.5个字符的时间,但是没有更多关于如何确定此间隔的数据.和wat是计算分离时间的步骤?

am new to Modbus and developing an application using Modbus RTU. I would like to know how to find out the RTU message frame separation time. In the Modbus RTU specification, It mentions 3.5 chars time, but there is no more data about how i can decide this intervals. and wat are the steps to calculate the separation time?

推荐答案

看看在底部,您会找到一条注释,说明字符间超时(t1.5)和帧间延迟(t3.5)的值.

At the bottom you will find a remark explaining the inter-character time-out (t1.5) and inter-frame delay (t3.5) values.

对于波特率,超过19200的值是固定的.为了降低波特率,需要对其进行计算(摘自Arduino的SimpleModbusMaster库):

For baud rates over 19200 values are fixed. For slower baud rates they need to be calculated (extract from SimpleModbusMaster library for Arduino):

// 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; 
}

这篇关于计算Modbus RTU 3.5个字符的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆