Examples:
Send frame: [01 04 00 02 00 02 D0 0B], the meaning is as follows:
[01]: Slave address
[04]: Function code
[00 02]: The starting register address is 0x02
[00 02]: Read 2 registers starting from the starting address (that is, read
1single-precision floating-point data result)
[D0 0B]: CRC check data
Return frame: [01 04 04 CC CD 41 48 65 4D], the meaning is as follows:
[01]:salve address
[04]:function code
[04]:The number of bytes returned (here 4)
[00 00 41 C8] :41 C8 00 00 (that is, the floating-point value is 25, the specific
meaning of the value is to find the corresponding address)
(Note: Combine two 16-bit integer registers to form a single-precision floating-point
number, pay attention to the order of the data)
Host sensds [01 04 00 02 00 04 50 09]
[01] Indicates the electrode address, where the electrode address is 1
[04] Indicates function code, here use function code 04 to read the measured value
[00 02] Indicates the starting register address, where the starting register address is 2
[00 04] Indicates the number of read registers, here 4 registers are read
[50 09] Represents CRC check code
Electrode return data [01 04 08 00 00 40 E0 00 00 41 C8 9A DD]
[01] Indicates the electrode address, where the electrode address is 1
[04] Indicates function code, here use function code 04 to read the measured value
[08] Indicates the number of data bytes, there are 8 bytes here
[00 00 40 E0] These 4 bytes represent the pH value, and the value is represented by a floating
point number, [00 00] is the low 16 bits, [40 E0] is the high 16 bits, that is, the 32-bit floating
point number is [40 E0 00 00 ], converted to a decimal number, it is 7, and the pH value is 7
[00 00 41 C8] These 4 bytes represent the temperature value, the value is represented by a
floating point number, [00 00] is the low 16 bits, [41 C8] is the high 16 bits, that is, the 32-bit
floating point number is [41 C8 00 00 ], converted to a decimal number, it is 25, and the
temperature value is 25 degrees Celsius
[9A DD] means CRC check code