emelianov / modbus-esp8266

Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Write Single Holding Register on Modbus functio code 06

simogaspa84 opened this issue · comments

Hi @emelianov

Can you provide an example code about how to call a single holding register write function?

Example

0B 06 0004 ABCD 7604

0B: The Slave Address (0B hex = address 11)
06: The Function Code 6 (Write Single Holding Register)
0004: The Data Address of the register (0004 hex = 4, + 40001 offset = register #40005).
ABCD: The value to write.
7604: The CRC (Cyclic Redundancy Check) for error checking.

Thanks a lot