ModbusSlaveNode: *cbFunc[]()

[Modbus]

描述

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.

語法

uint8_t Func1(function, address, length)
{
return EXCEPTION_CODE;
}
node1.cbFunc[MODBUS_CB_CODES] = Func1;

參數

  • 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

範例

請參照 Modbus Slave 範例.

也可以看看


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール