X hits on this document





21 / 37

MODBUS Communications Driver - Functions

Delays: Get/Set Communications Delays


short status = MB GetDelays(long *charDelay, long *frameDelay); short status = MB SetDelays(long charDelay, long frameDelay); _ _


Error Return


Character Timeout


Frame Timeout

Integer Long Integer (milliseconds) Long Integer (milliseconds)


The MODBUS protocol has no explicit framing, that is, it does not have codes that indicate when a message begins or ends. Instead, the protocol relies on time. Specifically, the protocol says that the end of each message is marked by a “silent” period lasting for at least the length of time required to transmit two and one half characters at the current baud rate.

Because of this design, the Driver must use a pair of time delay values to determine when a message is complete.

Character Timeout

The Character Timeout tells the Driver how long it should wait before determining that an incoming message is complete. In most cases, the default value of 50 milliseconds should be adequate.

Note. This is a 32-bit quantity.

However, if you frequently have problems receiving replies from the MODBUS device, or if you are communicating at low baud rates, you may need to increase this value.

Note that the Character Timeout value is only used once an incoming message has started to arrive. The Frame Timeout value determines how long the Driver will wait for an incoming message to begin.

Reducing the Character Timeout value may provide increased throughput if you are trying to sample at the maximum possible rate. However, values below 50 milliseconds may cause erratic operation on some computers.

Frame Timeout

This value determines how long the control waits for an incoming MODBUS message to begin, either in response to an outgoing command or while “listening” for an incoming command.

When you transmit a MODBUS command using any of the Driver’s command methods, it will wait for a reply to begin arriving for the time specified by the Frame Timeout value. Once the reply

Revision 2.210

June 6, 1998

Page 13

Document info
Document views61
Page views63
Page last viewedWed Oct 26 01:01:50 UTC 2016