Home > Software engineering >  Modbus return data parsing
Modbus return data parsing

Time:10-01

Modbus serial communication to send 03 01 00 00 0 a 06 E5 CA
03 01 0 c 28 F6 AC 9 41 b 3 d 42 c 8 e 3 b 40 C1 C1 1 c
The first double word data: 28 F6 41 AC,
The second double word data: 9 b 3 d 42 1 c,
The third double word data: 8 e 3 b 40 C1,
Parse the data
41 AC for the first word, high character, 28 F6 to low word, according to IEC single-precision floating-point processing, 21.52;
The second word, 42 1 c for high words, 9 b 3 d for the low word, according to IEC single-precision floating-point processing, 39.1516;

The third word, E1 C1 of high words, 8 e 3 b as low word, according to the IEC single-precision floating-point processing, 4.463088 * 10 ^ 20;

28 F6 41 AC how VB out 21.52 projects need to parse the data? VB how to write the parsing process, do not need to walk the modbus protocol, CRC check in the end is not a serial transmission.

CodePudding user response:

 Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any Source, As Any, ByVal Length As Long) 


Funtion getit ((a) as byte) as single
Dim as single b
Copymemory b, a (0), 4
Getit=b
End the function

A byte of data from low to high in the order of the modbus returned data, if to access unit 16, by the order of the two units get back data will be different from the normal, pay attention to the adjustment

CodePudding user response:

Use scale temporarily also can't satisfy the demand, don't have time to go to the concrete elaboration, it is simple to use gigasoft function
  • Related