[Modbus]
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 that returns a Byte of EXCEPTION_CODE.function: Modbus packet function code.address: The address of the bit that the Modbus packet wants to access.length: The length of the space that the Modbus packet wants to access.cbFunc[]: Call-back function letter array.MODBUS_CB_CODES: The callback function has a column index value and supports the following function codes.MODBUS_CB_READ_COILS
MODBUS_CB_READ_DISCRETE_INPUTS
MODBUS_CB_READ_HOLDING_REGISTERS
MODBUS_CB_READ_INPUT_REGISTERS
MODBUS_CB_WRITE_SINGLE_COIL
MODBUS_CB_WRITE_SINGLE_REGISTER
MODBUS_CB_WRITE_MULTIPLE_COILS
MODBUS_CB_WRITE_MULTIPLE_REGISTERS
MODBUS_CB_MASK_WRITE_REGISTER
Example
Please refer to the Modbus Slave example.
See Also
Libraries Reference Home
The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.