I have done a bunch of searching on this topic but haven't really found any answers that seem to fit so I apologize if its a redundant topic.
I have a modbus/TCP connection to a Pacmac bagger.
I am getting the read side no problem but when I got to write to a coil to reset some counters I am getting bad data
Here is the error from the log
The problem here is your device has a broken Modbus implementation. The response it's returning is 1 byte short.
3e 25 tx id
00 00 protocol version
00 05 frame length
00 unit id
05 function code
01 f8 output address
ff output value (should be 2 bytes)
This isn't a configuration issue. Any time you do this write and get this broken response the driver is going to throw an error and reconnect, and you'll get bad tag quality and a failed write response to go with that event.
If you initiated the write from a script, and used system.opc.writeValue instead of system.tag.writeBlocking, you could just ignore the bad quality that gets reported. I may be wrong about this causing the driver to reconnect.
But you should also report this to the vendor of that device. The reason I wanted a Wireshark capture is it presents a more objective view of what's going on, rather than trusting the logs from one of the software involved.
Yeah typing the email to the vendor as we speak....
So the writeValue will automatically ignore the bad quality? Or is there more script I need to ignore it...
I am using a one shot button so will try and script with a momentary button
It's not totally clear to me why the rest of your data goes bad quality. Maybe if you provided full logs and a Wireshark capture I could tell you more.
It's possible that missing byte is showing up at the front of the next response, in which case yes, everything is properly f8cked and you need the OEM to fix their broken Modbus implementation.
You could work around it with my Advanced Modbus Driver's scripted system.opc.rawModbus() utility function. You'd generate your own "Write Single Coil" payload, and lie about the expected response length to match what this dumb device is doing.
Ah ha
So they are wrong as suspected. They are saying to work around I can write to multiple registers.
Not seeing in my head how to make that happen. I am assuming I can send some sort of Binary value like'010' or '100' to trigger the correct register but how do I set that up as a tag?
You don't set that up as a tag. Just provide a list of consecutive tags and corresponding list of booleans to system.tag.writeBlocking() and the driver will combine into a single function code.