[Modbus]
描述
接收並解析 Modbus 封包,並根據指令存取暫存器與呼叫回呼函式。
當功能碼為 Read 指令時,會先呼叫回呼函式再讀取暫存器回傳;當功能碼為 Write 指令時,會先寫入暫存器再呼叫回呼函式;當功能碼為 ReadWrite 指令時,會先寫入暫存器再呼叫 Write 回呼函式,之後呼叫 Read 回呼函式,最後讀取暫存器回傳。
語法
node1.poll()
node2.poll(buf, size)
參數
node1/node2
:ModbusSlaveNode物件。buf
:使用者自定義暫存器空間。size
:該自定義空間之大小。
回傳
Int:已接收到的 Modbus 封包長度。
範例
請參照 Modbus Slave 範例.
也可以看看
函式庫參考主頁面
86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。