03-16-2023 09:21 AM
Hello guys,
I currently working with Modbus protocol and I need a modbus sniffer.
I have 2 systems communicating with each other using modbus RTU (half-duplex) and I need a library that decode the serial frames I'm getting.
Modbus has a lot of function and exception code so coding it manually would take me a lot of time.
I guess I'm not the 1st one to work with something like that, do you have in mind any library or something like that, that could help me ?
Thanks and see you soon I hope 😉
Solved! Go to Solution.
04-07-2023 09:12 PM
Hi Ten,
You can use the native Modbus Library API which can be downloaded from VI Package Manager when interfacing with LabVIEW.
Hope this helps.
04-11-2023 01:40 AM
Hi,
When I have the ModBus communication running I don't need a sniffer anymore. Even if you get exceptions. Because receiving an exception means that the (basic) communication is Ok.
You know what you are sending to the slave. If you get an exception I think the manual of the slave (RTFM) would be of more help than a sniffer.
Kees
04-04-2025 01:52 PM
Hey.
In fact I'm validating communication between 2 products and I need to spy the communication.
In fact I just developped an algorythm to separate the request from the response and then I parse the frames.
The separation is not easy because no start or stop bit with modbus rtu.
So I determined that I can't have 2 requets in a row and when I get a request, I parse the frame and I wait for the next one, wich will be a response, and so on.
Thanks for your response anyway, problem solved.
02-13-2026 03:30 AM
Hey,
Can you show how you did it.
Did you use the modbus library or just the VISA serial vi's?
Thanks in advance.
02-13-2026 11:21 AM
@BerthilG wrote:
Hey,
Can you show how you did it.
Did you use the modbus library or just the VISA serial vi's?
Thanks in advance.
The original author hasn't posted for almost a year so it's unlikely they'll just casually drop by and see this thread. Your best bet would be to send them a message directly instead of just posting in this thread.
There's also a chance you could get a better response by starting your own thread with a much better explanation of what it is you need to do and what your limitations are. Right now it seems like you are requesting a solution but the solution you are looking for is one that sounds like it might be the wrong type of solution to most problems, and stating the entire problem might let people offer better and hopefully simpler solutions.
02-13-2026 12:35 PM
Hello,
I recoded the frame parsing with VISA.
It is not just 1 VI, it is a bit more so I can not really give you all this but here is the example simplified:
In my case I have 1 master with 1 slave and it works well.
I also had to put a timeout of 50ms (editable) to reset the com in the case where my state machine does not succeed parsing a correct frame. For example, a 0x00 byte was in my input frame with no reason, it will ruine all the future parsing. After 50ms (1 or 2 frames lost maybe) I start my state machine from zero.
Obviously I log the lost data to search an explanation to this unwanted byte later.
The modbus library was too specific and really designed to manage 1side slave or master communication.
But maybe you can do use it. Most of the time I lack patient ^^'
Hope this will help !