Code Monkey home page Code Monkey logo

rp2040-modbus_example's Introduction

Modbus RTU Slave library for Raspberry Pi Pico (RP2040) based on the C++ SDK

This repository contain working example Modbus RTU Slave implementation for rp2040 (Raspberry Pi Pico) with C++ SDK

Features:

  • Modbus RTU Slave
  • RS-485 support
  • C++ style class
  • Registers layout
  • Separate setup read-only and read-write registers
  • UART 0 and 1 support
  • it works out of box and tested

How to use the example:

  • Tune VS Code for Raspberry Pico development (instruction)
  • You can use 2nd Raspberry Pico as a bootloader and debuger (instruction)
  • Modify launch.json and setting.json files in .vscode according to your environment
  • Start the debugging session
  • Use Modbus Master emulator for connection (ModBus Poll for example)
  • Change UART parameters in main.cpp and registers layout in modbus.cpp for your purpose
  • Change stored data inside Modbus Manager class
  • Change Switch-case optins according to your data and registers in mb_read_holding_register() and mb_write_single_register()

TODO:

  • incapsulation for class data
  • register layout definition throw init
  • register checking throw std::dict instead of switch-case
  • move on_mb_rx() to class logic
  • mb_write_multiple_registers()
  • mb_read_input_registers()

rp2040-modbus_example's People

Contributors

gleboss-redfab avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.