Read Modbus TCP Register from Huawei Wechselrichter
Posted: Sun Dec 17, 2023 3:42 pm
Dear all
After hour and hour trying may be there is somebody who can help me. I try to read a Modbus TCP register.
questions
1. In which format I have to write the socket?
2. What is the correct read command?
3. How do I have to interpret the "modusResponse"
Any help?
Daniel
open socket "xxx
put "000100000006010436b00001" into modbusQuery
put binaryEncode("H*", modbusQuery) into modbusQuery
write modbusQuery to socket "xxx"
read from socket "xxx" for 8 bytes
put it into modbusResponse
close socket "xxx"
-- Interpretiere die Modbus-Antwort
if length(modbusResponse) = 8 then
put char 10 to -1 of modbusResponse into dataBytes
put binaryEncode("H*", dataBytes) into hexData
answer "Empfangene Daten: " & hexData
else
--answer "Ungueltige Modbus-Antwort - Laenge: "
end if
After hour and hour trying may be there is somebody who can help me. I try to read a Modbus TCP register.
questions
1. In which format I have to write the socket?
2. What is the correct read command?
3. How do I have to interpret the "modusResponse"
Any help?
Daniel
open socket "xxx
put "000100000006010436b00001" into modbusQuery
put binaryEncode("H*", modbusQuery) into modbusQuery
write modbusQuery to socket "xxx"
read from socket "xxx" for 8 bytes
put it into modbusResponse
close socket "xxx"
-- Interpretiere die Modbus-Antwort
if length(modbusResponse) = 8 then
put char 10 to -1 of modbusResponse into dataBytes
put binaryEncode("H*", dataBytes) into hexData
answer "Empfangene Daten: " & hexData
else
--answer "Ungueltige Modbus-Antwort - Laenge: "
end if