writing a single byte data in modbus #1303
-
Hii ! function code 0x06 and 0x10 are used to read and write analog holding register respectively and the length of analog holding registers are 2 bytes. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Write_register automatically converts the value you send to big endian (depending on your CPU) for each register. However you need to check if a register swap (words) is needed. In other words, the byte swapping is done automatically because it is within 1 register, but word swapping is responsibility of the app. No it is not possible to write bytes, a register is defined as 2 bytes. so each address is 16bit wide, not 8bit. |
Beta Was this translation helpful? Give feedback.
-
Please read the modbus specification https://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf |
Beta Was this translation helpful? Give feedback.
Write_register automatically converts the value you send to big endian (depending on your CPU) for each register. However you need to check if a register swap (words) is needed.
In other words, the byte swapping is done automatically because it is within 1 register, but word swapping is responsibility of the app.
No it is not possible to write bytes, a register is defined as 2 bytes. so each address is 16bit wide, not 8bit.