How to implement the 1,5 and 3,5 char interval in Modbus RTU

B

Thread Starter

bierbauch

Hello together,

I'm searching an idea on How to implement the 1,5 and 3,5 char interval in Modbus RTU. I try use Modbus on RS232 on a Linux System with ANSI C.

I tried the select() function, but the resolution is too less (only 1/256 = 3,9ms). For the ModBus RTU I have to check a time 520µs (19200 Baud).

Can somebody help me, please?

Thanks a lot.
 
L

Lynn A Linse

You don't need these - and if you do succeed perfectly you'll find lots of other products that can NO LONGER work with you as they themselves do NOT do it properly. So it's kind of a catch-22. I've never used this and have well over 100,000 devices out in the field using my Modbus/RTU code.

Are you a "slave" or a "master"? In either case, you should have complete knowledge of the messages you are sending, so just watch the message as it arrives and detect end-of-message by the content. Of course, you still need to handle over-all timeouts to detect if a remote stops sending half way through the message.

See my discussion here:
http://www.iatips.com/modbus_rtu.html#char35

best regards
- LynnL, www.digi.com
 
I agree with Lynn.

I implement them strictly, but I offer the user the ability to tweak them. In my "robust mode" I use 50ct for the 1.5ct and a 10ct for the 3.5ct. My "strict mode" is 1.5 & 3.5. The robust mode works great with windows applications.

The 3.5ct is a minimum of 3.5 according to the spec, if I remember correctly, BUT if the master used 8ct instead of 3.5 and the slave sends with 3.5 then you would have a problem. I have seen this with MicroMotion coriolis meters!!!

The 1.5 is to determine if a break in a packet occurs. The 1.5 is difficult in some cases because you must receive a byte entirely (so the gap = 1.5ct, but the timeout = 2.5ct) but if you use a FIFO trigger greater than 1 and you have not filled to the trigger point, then you must wait for the FIFO timeout, which is usually much much longer than 1.5ct! The other alternative would be to poll the UART but why?

Max
[email protected]
 
Top