You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2022/02/21 12:09:47 UTC

[plc4x] branch develop updated: fix(protocols/modbus): PLC4X-335: Using single-byte modbus types resulted in unexpected behaviour

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 55044d6  fix(protocols/modbus): PLC4X-335: Using single-byte modbus types resulted in unexpected behaviour
55044d6 is described below

commit 55044d64896e2e2eabac5c6a3dec8a85274ebf8e
Author: cdutz <ch...@c-ware.de>
AuthorDate: Mon Feb 21 13:07:58 2022 +0100

    fix(protocols/modbus): PLC4X-335: Using single-byte modbus types resulted in unexpected behaviour
---
 .../main/resources/protocols/modbus/modbus.mspec   | 29 ++++++++++++----------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec b/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
index 9cb469e..5151548 100644
--- a/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
+++ b/protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
@@ -273,38 +273,40 @@
 [dataIo DataItem(ModbusDataType dataType, uint 16 numberOfValues)
     [typeSwitch dataType,numberOfValues
         ['BOOL','1' BOOL
-            [reserved uint 7 '0x00']
-            [simple   bit    value]
+            [reserved uint 15 '0x0000']
+            [simple   bit     value   ]
         ]
         ['BOOL' List
             [array bit value count 'numberOfValues']
         ]
         ['BYTE','1' BitString
-            [simple uint 8 value]
+            [reserved uint 8 '0x00']
+            [simple   uint 8 value ]
         ]
         ['BYTE' List
-            [array uint 8 value count 'numberOfValues']
+            [array bit value count 'numberOfValues * 8']
         ]
         ['WORD','1' BitString
             [simple uint 16 value]
         ]
         ['WORD' List
-            [array uint 16 value count 'numberOfValues']
+            [array bit value count 'numberOfValues * 16']
         ]
         ['DWORD','1' BitString
             [simple uint 32 value]
         ]
         ['DWORD' List
-            [array uint 32 value count 'numberOfValues']
+            [array bit value count 'numberOfValues * 32']
         ]
         ['LWORD','1' BitString
             [simple uint 64 value]
         ]
         ['LWORD' List
-            [array uint 64 value count 'numberOfValues']
+            [array bit value count 'numberOfValues * 64']
         ]
         ['SINT','1' SINT
-            [simple int 8 value]
+            [reserved uint 8 '0x00']
+            [simple   int 8  value ]
         ]
         ['SINT' List
             [array int 8 value count 'numberOfValues']
@@ -328,7 +330,8 @@
             [array int 64 value count 'numberOfValues']
         ]
         ['USINT','1' USINT
-            [simple uint 8 value]
+            [reserved uint 8 '0x00']
+            [simple   uint 8 value ]
         ]
         ['USINT' List
             [array uint 8 value count 'numberOfValues']
@@ -379,16 +382,16 @@
 ]
 
 [enum uint 8 ModbusDataType(uint 8 dataTypeSize)
-    ['1' BOOL ['1']]
-    ['2' BYTE ['1']]
+    ['1' BOOL ['2']]
+    ['2' BYTE ['2']]
     ['3' WORD ['2']]
     ['4' DWORD ['4']]
     ['5' LWORD ['8']]
-    ['6' SINT ['1']]
+    ['6' SINT ['2']]
     ['7' INT ['2']]
     ['8' DINT ['4']]
     ['9' LINT ['8']]
-    ['10' USINT ['1']]
+    ['10' USINT ['2']]
     ['11' UINT ['2']]
     ['12' UDINT ['4']]
     ['13' ULINT ['8']]