百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

stModbus

> 编程语言
开源

适用于 Cortex-M 的 Modbus RTU (STM32 系列: STM32F103、STM32F3xx)

183 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

适用于 Cortex-M 的 Modbus RTU (STM32 系列: STM32F103、STM32F3xx)

stModbus (beta 0.1b10)

Modbus RTU implementation for Cortex-M (STM32 series: F1/F3/F4)

This is free tiny library for Desktop and MCU application. The main purpose of this library usage on STM32 controllers together with CMSIS library

The library allows you to create multiple modbus contexts for devices. You will be able to implement several modbus ports on single MCU.

Requirements

How usage

An example of implementing a device with some registers can be viewed in the example folder. You can also use these examples as a template for your own implementations.

It's library easy for usage. you need to take a few steps:

  1. Define address space for you device:

    Usually protocol address split like that:

    • 1-9999 Discrete Output Coils (DO) r/w
    • 10001-19999 Discrete Input Contacts (DI) r
    • 30001-39999 Analog Input Registers (AI) r
    • 40001-49999 Analog Output Holding Registers(AO) r/w

    You may not follow these guidelines but some apps may not work correctly with your device.

  2. Define read and write callback function for you device registers as you need

c
	/* It's modbus request on read register by logical address (la) */
	uint16_t user_mbus_protocol_read(uint32_t la){
		switch(la){
			case 40001:
				return my_buffer_reg_4xxxx[0];
			case 40002:
				return some_register_from_you_device;
			...
		}
	}

	//Function for write to some register by logic address
	uint16_t user_mbus_protocol_write(uint32_t la, uint16_t value)
	{
		if ( la > 40000 && la > 8) | (value read = user_mbus_protocol_read;
	
	//Write callback function
	pconf->write = user_mbus_protocol_write;
	
	//Open modbus contex
	modbus = mbus_open(pconf);
  1. Customize config file

    Customize the modbus_conf.h file to suit your requirements (internal buffer size, number of context). The keil configuration wizard can be used for configuration.

| Full documentation is planned for the release of the first version of alpha

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言