Colway Solutions
Modbus Member Logo

Select Modbus Framing Type(RTU or TCP)

 

The library supports two modes of Modbus communication, Modbus RTU and Modbus TCP. This can be set at compile time by setting the value of the MODBUS_MODE macro.

 

Steps

a)   Open file MSPL_UserIf.h

b)   Locate the definition of macro MODBUS_MODE

c)    To configure the library to run in Modbus TCP mode, change the above macro's value to MODBUS_TCP. To set it to Modbus RTU mode, change the macro's value to MODBUS_RTU. The modified line should look like this:

#define MODBUS_MODE MODBUS_TCP /* for TCP communications */

#define MODBUS_MODE MODBUS_RTU /* for RTU communications */

d)   Rebuild your project and test.

 

Notes

  • Since this is a compile time setting, the mode cannot be changed dynamically at run time.
  • Only one Modbus mode can be enabled at a time.
  •  

    Back to Index

    Privacy Policy Site Map FAQ Contact Us