RT-Thread online packages → IoT - internet of things → FreeModbus: Modbus master and slave stack → Slave mode
--- Slave mode
advanced configuration --->
* Enable RTU slave mode
[ ] Enable ASCII slave mode
* Enable TCP slave mode
[ ] Use Contorl Pin
* Enable slave sample
(1) Slave device address
配置如上,保存后 rtconfig.h文档插入内容如下
。。。
#define PKG_USING_FREEMODBUS
#define PKG_MODBUS_SLAVE
#define RT_S_DISCRETE_INPUT_START 0
#define RT_S_DISCRETE_INPUT_NDISCRETES 16
#define RT_S_COIL_START 0
#define RT_S_COIL_NCOILS 64
#define RT_S_REG_INPUT_START 0
#define RT_S_REG_INPUT_NREGS 100
#define RT_S_REG_HOLDING_START 0
#define RT_S_REG_HOLDING_NREGS 100
#define RT_S_HD_RESERVE 0
#define RT_S_IN_RESERVE 0
#define RT_S_CO_RESERVE 0
#define RT_S_DI_RESERVE 0
#define PKG_MODBUS_SLAVE_RTU
#define PKG_MODBUS_SLAVE_TCP
#define PKG_MODBUS_SLAVE_SAMPLE
#define MB_SAMPLE_SLAVE_ADDR 1
#define MB_SLAVE_USING_PORT_NUM 3
#define MB_SLAVE_USING_PORT_BAUDRATE 115200
#define PKG_USING_FREEMODBUS_LATEST_VERSION
。。。
试过
pkgs --install freemodbus
pkgs --update
pkgs --force-update
好像都没有效果
以前用rt-thread studio 配置好后是自动安装的,不知这个在终端里面是怎么操作的!知道的烦请告诉一声,谢谢!
最近编辑记录 pineyer (2025-02-08 11:00:10)
离线
这些 pkgs 命令 是在vscode 的terminal里面输入的,是不是有效地方没配置好?
最近编辑记录 pineyer (2025-02-08 11:11:17)
离线