Description Write to Discrete Inputs register. Syntax node1.writeDiscreteInput(address, value) node2.writeDiscreteInput(address, size, buffer) Parameters node1/node2: ModbusSlaveNode object. address: Discrete Inputs register address to be written. value: Single Discrete Inputs register value to be written. size: The number of Discrete Inputs registers to be written. buffer: Copy the array data in the array space pointed to by […]
Description Read the Coils register. Syntax node1.readCoil(address) node2.readCoil(address, size, buffer) Parameters node1/node2: ModbusSlaveNode object. address: Coils register address to be read. size: The number of Coils registers to be read. buffer: Copy the read Coils register array data to the array space pointed to by buffer. Return int: Return the Coil position data when using […]
Description Write to the Coils register. Syntax node1.writeCoil(address, value) node2.writeCoil(address, size, buffer) Parameters node1/node2: ModbusSlaveNode object. address: Coils register address to be written. value: Single Coils register value to be written. size: The number of coil registers to be written. buffer: Copy the array data in the array space pointed to by buffer to the […]
Description cbFunc is a callback function pointer array. When poll() receives the corresponding function code, it will call the corresponding function pointed to in the cbFunc array. Syntax uint8_t Func1(function, address, length) { return EXCEPTION_CODE; } node1.cbFunc[MODBUS_CB_CODES] = Func1; Parameters node1: ModbusSlaveNode object. Func1: User-defined function, returns a Byte EXCEPTION_CODE. function: Function code of Modbus […]
Description Receive and parse Modbus packets, and access registers and call callback functions according to commands. When the function code is a Read command, the callback function will be called first and then the register will be read back; when the function code is a Write command, the register will be written first and then […]
Description Initialize the ModbusMaster object and assign it to the Serial class or the IPAddress class. Syntax bus1.begin(mode, serial) bus2.begin(mode, modbus_server_ip) Parameters bus1/bus2: ModbusMaster object. mode: Specifies the communication mode of the ModbusMaster object. Its arguments are MODBUS_RTU, MODBUS_ASCII, or MODBUS_TCP. serial: specifies the Serial class as the transmission channel. modbus_server_ip: specifies the IPAddress class […]
Description Initialize the ModbusMasterNode object and specify the mounting channel and the corresponding node number. Syntax node1.attach(slave_id, bus1) node2.attach(bus2) Parameters node1/node2: ModbusMasterNode object. slave_id: Specifies the corresponding Slave node number. In TCP mode, if the number is not specified, the number will be preset to MODBUS_TCP_SLAVE (0xFF). bus1/bus2: Specifies the ModbusMaster object to be mounted. […]
Description Initializes the ModbusSlaveNode object and specifies the mount channel and node number. Syntax node1.attach(slave_id, bus1) node2.attach(bus2) Parameters node1/node2: ModbusSlaveNode object. slave_id: Specifies the slave node number. In TCP mode, if the number is not specified, the number will be preset to MODBUS_TCP_SLAVE (0xFF). bus1/bus2: Specifies the ModbusSlave object to be mounted. Return bool: If […]
Description Initializes a ModbusSlave object and specifies the mode and channel. Syntax bus1.begin(mode, serial) bus2.begin(mode) Parameters bus1/bus2: ModbusSlave object. mode: specifies the communication mode of the ModbusSlave object, and its arguments are MODBUS_RTU, MODBUS_ASCII, or MODBUS_TCP. serial: When mode is specified as MODBUS_RTU or MODBUS_ASCII, the Serial class must be specified as the transmission channel. […]
Modbus86 Slave can make 86Duino simulate a Modbus Slave node, receive commands on the channel and execute callback functions. Example Example of a slave device that enables RS485 and uses Modbus RTU as the communication method 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 […]