Hey Soeren,
Indeed this might be a gap in current protocol logic. Given that write
requests might contain multiple data points/registers we assumed
write-multiple as default. Restrictions you mentioned are very common
for many devices hence we shall update logic somehow.
Currently, as far I know, we have no clear way for calling program to
define "write" kind. Obviously we can always try to assume that single
write request should be handled as single write and not multiple. As far
I know Murphy's law we will then find devices which require write
multiple even for single register. ;-)
There are no good answers yet, but its good you brought issue up.
Maybe we need to open write api a little bit to let caller pass some
portion of driver specific metadata?
Best,
Łukasz
On 07.10.2021 20:41, Soeren Sprenger wrote:
Hi folks,
I just have a little problem controlling my Keba wallbox with Modbus
TCP. Reading all values works fine with the PLC4X Modbus driver in
version 0.9.0, but I have a problem writing.
The Modbus driver uses - no matter what I do - the function code 16
"Write Multiple Registers", but I am only allowed to use function code 6
"Write Single Register" in the PLC.
It should work like this:
builder.addItem("charging_current", "holding-register:5004:UINT", 8000);
I started debugging, with my plain-old-c implementation i get it done,
the resulting packed to the PLC is like:
With the PLC4X:
So i started digging in the code, i found the ModbusProtocolLogic class,
in the "getWriteRequestPdu" there is no support for getting any instance
of the required ModbusPDUWriteSingleHoldingRegistersRequest, just for
ModbusPDUWriteMultipleHoldingRegistersRequest.
This seams like a conceptual problem in here, or i misunderstood the code.
Can you please give me a hint, how you would fix this?
Maybe we need something like holding-register: vs holding-registers: in
the field specification, or make the getWriteRequestPdu more
sophisticated to find out that there is just a write to a single field.
Thank you,
Soeren
--
AereA GmbH
Sitz: Wüstenstein 18, 91346 Wiesenttal
Geschäftsführerin: Franziska Sprenger
Handelsregister: Bamberg B10466
E-Mail: [email protected] <mailto:[email protected]>
Web: http://www.aerea.de <http://www.aerea.de>
Fon: +49 (0) 36424 760823
Fax: +49 (0) 36651 1390009