Lisää testiä client ohjelmalla "Simply Modbus TCP Client 8.0.4".
Hakemalla funktiokoodilla 3 ja osotteella 40001 yhden rekisterin homma toimii hienosti. Vaan kun näppää päälle "2 byte ID" niin vastaus on "Exeption Response: 03 = Illegal Data Value". Pieni guugletus ja talologgerin modbus moduulin tarkastelun jälkeen kyse mahtaa olla ns. MBAP Headerista:
MBAP Header
A new 7-byte header called the MBAP header (Modbus Application Header) is added to the start of the message. This header has the following data:
Transaction Identifier: 2 bytes set by the Client to uniquely identify each request. These bytes are echoed by the Server since its responses may not be received in the same order as the requests.
Protocol Identifier: 2 bytes set by the Client, always = 00 00
Length: 2 bytes identifying the number of bytes in the message to follow.
Unit Identifier: 1 byte set by the Client and echoed by the Server for identification of a remote slave connected on a serial line or on other buses.
S7 ei siis ymmärrä tätä 2 byte identtiä?
Ja talologgerin vikailmotus "ModbusClient: ERROR: Invalid response data: Exception in functioncode" on sama kuin simply modbusin ""Exeption Response: 03 = Illegal Data Value"?
Mites tämä puukotetaan pois talologgerin koodista?
T:Miika
Edit:
Tässä hex rimpsut ensin onnistuneesta kyselystä ja sen jälkeen epäonnistuneesta "2 byte ID" pyynnöstä:
2016/10/21 19:54:29 >>> 00 01 00 00 00 06 01 03 00 00 00 01
2016/10/21 19:54:29 < 00 01 00 00 00 05 01 03 02 00 00
2016/10/21 19:54:35 >>> 00 02 00 00 00 07 00 01 03 00 00 00 01
2016/10/21 19:54:36 < 00 02 00 00 00 03 00 81 03
Exception Response
03 = Illegal Data Value
Edit2:
Taisi olla huuhaa tuo minun MBAP header homma. Taitaa olla selitys sille miten RTU muuttuu TCP:ksi.
Kokeilin nyt laittaa pöytäkoneelle Modbus serverin ja yhistellä talologgeria siihen. Ei toimi sekään. Seuraavaksi serverin asetuksista "Ignore Unit ID" niin sen jälkeen homma rupesi pelaamaan ja talologgerin näyttää arvot niinku pitää.
Eli ongelma on siis tosiaan talologgerissa ja Unit ID:n lähetyksessä. Täytyy vielä yrittää löytää S7 konffista sama ignore unit id täppi niin sitten ei ois ongelmaa ollenkaan.
