It is my intention to address a device with Modbus via the Web Serial API built into Google Chrome. I want to address my device with a HEX code. The following screenshot proves that my device can be successfully addressed with a tool like this. The interface is thus addressed with the following hex value: 01 03 00 01 00 02 95 CB
My question now is. The Tutorial only shows how to address the interface as Uint8Array or Text. How can I address the interface with a HEX code?
Thanks for the help
As indicated in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array, the
Uint8Array
typed array represents an array of 8-bit unsigned integers.In JavaScript,
0x
is used to indicate that all subsequent characters should be interpreted as hexadecimal (base 16 number system).Therefore, all you need would be something like: