Modbus Component

Installation

The component requires ESP-IDF 5.0 and higher and is installed using IDF Component Manager.

Add this to the idf_component.yml in the project main directory or in the component directory:

dependencies:
  pl_modbus:
    path: component
    git: https://github.com/plasmapper/modbus-esp-cpp.git

Add this to the source code:

#include "pl_modbus.h"

Add extern "C" to the app_main function:

extern "C" void app_main(void) {...}

Add this to the sdkconfig.defaults in the project directory or configure the values using Project Configuration:

CONFIG_COMPILER_CXX_RTTI=y
CONFIG_LWIP_SO_RCVBUF=y

Features

  1. PL::ModbusClient - a Modbus client class.

  2. PL::ModbusServer - a Modbus server class.

Examples

API reference