I am implementing the modbus myself, and I have found that if I send a series of commands (for example several 0x10 commands followed by a 0x04 command), the T7 only returns a response for the first command in the sequence. I have confirmed with wireshark that this is true. I'm wondering if there is some sort of minimum required time between commands, although I haven't been able to find anything in the documentation. I am aware of the MBFB feedback function, but I would like to know how the T7 handles normal commands when they arrive sequentially.
You can write multiple registers using modbus function #16:
https://labjack.com/support/software/api/modbus/protocol-details
Is that what you are doing? Post the packet you are sending out and getting back like we do in the examples at the bottom of that page.
Hi, thanks for your response. Here are the bytes as reported from wireshark:
bytes sent to T7:
ab 90 00 00 00 09 01 10 ab 7f 00 01 02 00 08
ab 90 00 00 00 09 01 10 ab 7e 00 01 02 00 c7
ab 90 00 00 00 0b 01 10 ab 7c 00 02 04 41 20 00 00
ab 90 00 00 00 0b 01 10 ab 80 00 02 04 00 00 00 00
ab 91 00 00 00 06 01 03 00 60 00 a0
bytes received from T7:
ab 90 00 00 00 06 01 10 ab 7f 00 01
The query contains four #16 commands with transaction identifer 0xab90, followed by a single #3 command with transaction identifier 0xab91. The bytes sent to the labjack are all placed into one buffer and sent to the T7 in one call to send(). I have verified with wireshark that the only response I receive from the T7 is the one listed above, corresponding to the first command in the query.
PS here are some wireshark screenshots, one screenshot shows the query, the other shows the response. The highlighted bytes in the bottom panel indicate the start of the TCP payload
You can only send 1 modbus command at a time. Wait for the response before sending another command. Each modbus function #16 command can have lots of register writes.
Ok, thanks for the clarification. This should be documented more clearly, since there is effectively a "minimum time" between commands -- i.e. the time it takes for the server to respond. The problem with function 16 is that you can only write to a contiguous set of registers. Therefore it seems that the solution to writing to a set of discontinguous registers in one go is to use the MBFB function.
The fact that you need to wait for the response from a command before sending another command is a detail buried somewhere, but could use some more mention in the details of modbus.
Yes, that is why we "invented" the MBFB function which is not a standard modbus function. It also lets you mix writes and reads in the same packet.