Skip to content

Modbus cross platform C library containing master and slave implementation

License

Notifications You must be signed in to change notification settings

niwciu/MODBUS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ModBus corss platform C library

GitHub License
GitHub top language GitHub Release
GitHub branch check runs
example workflow example workflow example workflow example workflow

Features

  • Contain ModBus RTU Master and Slave implementation
  • Support the following functions:
    • Read Coils (0x01)
    • Read Discrete Inputs (0x02)
    • Read Holding Registers (0x03)
    • Read Input Registers (0x04)
    • Write Single Coil (0x05)
    • Write Single Register (0x06)
    • Write Multiple Coils (0x0F)
    • Write Multiple registers (0x10)
  • Possible to run master and slave functionality on one hardware platform
  • Contain examples of:
    • ModBus Master RTU implementation
    • ModBus Slave RTU implementation
    • ModBus Master & Slave implementation on one harwdware platform
  • Library contain unit test and integration tests that can be reused in project if needed

Library contents description

TBD

Examples

Library contain an examples of three different configurations that can be implemented in project. The fallowin configurations allow to run device as:

  • ModBus RTU Slave (ModBus RTU Sever)
  • ModBus RTU Master (ModBus RTU Client)
  • ModBus RTU Slave&Master (ModBus RTU Sever&Client)

How to run STM32G071RB ModBus RTU Slave example

Requirements for compiling and running the example:

  1. CMake installed
  2. Make or Ninja installed
  3. ARM GNU Toolchain (gcc-arm-none-eabi) installed
  4. STM32_Programmer_CLI installed
  5. ST-link (placed on Nucleo Board) installed

In order to test the slave node, any software that can simulate Modbus Master RTU is required. In my case I was using qModMaster

Hardware requirements, configuration, and connections

  1. STM32G071 Nucleo-64
    drawing{width=500;}

How to build and run the example

  1. Open the location you want to clone the repository to in your termina
  2. Clone the repository to your preferred localization
    git clone https://github.com/niwciu/MODBUS.git
  3. Enter to MODBUS/examples/STM32G071RB_MODBUS_SLAVE
    cd ./MODBUS/examples/STM32G071RB_MODBUS_SLAVE
  4. For Make type:
    cmake -S ./ -B Debug -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
    cd Debug
    make all
    make flash
  5. For Ninja type:
    cmake -S ./ -B Debug -G"Ninja" -DCMAKE_BUILD_TYPE=Debug
    cd Debug
    ninja
    ninja flash
  6. In some cases Nucleo board requires plugging out and in a USB port to run the program.

How to run ModBus STM32G071RB RTU Master example

Requirements for compiling and running the example:

  1. CMake installed
  2. Make or Ninja installed
  3. ARM GNU Toolchain (gcc-arm-none-eabi) installed
  4. STM32_Programmer_CLI installed
  5. ST-link (placed on Nucleo Board) installed

In order to test the Master node, any software that can simulate Modbus Slave RTU is required. In my case I was using xxx

Hardware requirements, configuration, and connections

  1. STM32G071 Nucleo-64
    drawing{width=500;}

How to run ModBus STM32G071RB RTU Master&Slave example

Requirements for compiling and running the example:

  1. CMake installed
  2. Make or Ninja installed
  3. ARM GNU Toolchain (gcc-arm-none-eabi) installed
  4. STM32_Programmer_CLI installed
  5. ST-link (placed on Nucleo Board) installed

In order to test the Master node, any software that can simulate Modbus Slave RTU is required. In my case I was using xxx

Hardware requirements, configuration, and connections

  1. STM32G071 Nucleo-64
    drawing{width=500;}

How to configure, use in project, colaborate and more

For information about the configuration and usage of the library, as well as collaboration in the project please refer to MODBUS wiki