morkai / h5.modbus

Implementation of the MODBUS IP/ASCII/RTU master and slave over TCP/UDP/Serial for Node.js.
https://miracle.systems/p/h5.modbus
MIT License
28 stars 21 forks source link

RTU Framing - Inter-frame delay/space #26

Open ekawahyu opened 6 years ago

ekawahyu commented 6 years ago

I have a question about the RTU framing. Which file should I look at to modify the 1.5 and 3.5 chars of inter-frame delay time? I was expecting to see in Transport.js or RtuTransport.js, but it was not there.

morkai commented 6 years ago

It's exposed in the RtuTransport as the eofTimeout option - a number of milliseconds after the last received byte after which end of frame is assumed. It's Node.js so you have to keep in mind that setTimeout(() => {}, 1) might trigger after 1ms or 1s.

ekawahyu commented 6 years ago

Yes, I understand completely that it would not be able to strictly follow the delay timing requirement by Modbus spec, but I was curious about where to look for it in case I need to modify it. Let me look at the eofTimeout.