maix::modbus::Slave
maix.modbus.Slave module
This is
maix::modbus::Slave
module of MaixCDK.
All of these elements are in namespacemaix::modbus::Slave
.For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!
Module
No module
Enum
Variable
Function
__init__
Constructor for creating a Modbus Slave instance with specified registers.\nThis constructor initializes a Modbus Slave using the provided mode and connection\nparameters. It also allows for defining register information through a\nRegisters
object, enabling easier management of multiple registers at once.
item | description |
---|---|
param | mode: Specifies the communication mode: RTU or TCP. ip_or_device: The UART device name if using RTU mode. If TCP mode is chosen, this parameter is ignored. registers: A Registers object that holds starting addresses and sizes for coils, discrete inputs, holding registers, and input registers. This allows the user to set up the Slave's register configuration in a structured manner. rtu_baud: The baud rate for RTU communication. Supported rates include: 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2500000, 3000000, 3500000, 4000000. Default is 115200. Ensure that the selected baud rate is supported by the underlying hardware and libmodbus. rtu_slave: The RTU slave address. Ignored in TCP mode. Default is 1. tcp_port: The port used for TCP communication. Ignored in RTU mode. Default is 502. debug: A boolean flag to enable or disable debug mode. Default is false. |
see | modbus.Mode for valid modes. |
C++ defination code:
Slave(maix::comm::modbus::Mode mode, const std::string& ip_or_device, const Registers& registers=Registers{}, int rtu_baud=115200, uint8_t rtu_slave=1, int tcp_port=502, bool debug=false)