12-14-2025 11:37 PM
Hi everyone,
I am a mechanical engineering student working on a graduation project involving a circulating bath control system. I am new to LabVIEW and facing a persistent VISA Read Timeout Error (-1073807339) with Modbus RTU (RS-232) communication.
[System Overview]
Hardware: Circulating Bath (Slave) connected via RS-232.
Protocol: Modbus RTU.
Goal: To control "Flow Rate" and "Pump ON/OFF" sequentially within a single While Loop.
[The Problem] The communication works perfectly when I only send the "Flow Rate Control" command. However, when I add the "Pump ON/OFF" command using a Flat Sequence Structure, the VISA Read returns a timeout error. When the error occurs, the "VISA Bytes at Serial Port" node returns 0, which implies the slave is not responding or the Write command was skipped.
[My Current Logic] I implemented a Flat Sequence Structure inside a While Loop to avoid race conditions:
Frame 0: Flow Rate Control (VISA Flush -> Write -> Wait 500ms -> Bytes at Port -> Read)
Frame 1: Wait (1000ms) for device stability.
Frame 2: Pump ON/OFF Control (VISA Flush -> Write -> Wait 500ms -> Bytes at Port -> Read)
Even with the Sequence Structure and delays, the first command often fails with a timeout (0 bytes received). Is there a structural issue with handling multiple Modbus commands in a single loop? Should I separate these into parallel While Loops (Producer/Consumer architecture) instead?
Any advice would be greatly appreciated. I have attached my block diagram screenshot for reference.
12-15-2025 12:37 AM
Hi dingding,
@dingding wrote:
Even with the Sequence Structure and delays, the first command often fails with a timeout (0 bytes received). Is there a structural issue with handling multiple Modbus commands in a single loop? Should I separate these into parallel While Loops (Producer/Consumer architecture) instead?
Any advice would be greatly appreciated. I have attached my block diagram screenshot for reference.
Do you think it's a good idea to provide a small downscaled (unreadable) edited image of the block diagram?
What I still can see: what is the purpose of those feedback nodes in the string wire to VISAWrite? Do you really think they are needed AND helpful?
12-16-2025 10:07 AM - edited 12-16-2025 10:09 AM
I can't see the image or open your code but I have one question and some advice.
Why aren't you using one of the Modbus libraries that are available for LabVIEW?
NI Modbus Library is free and full featured, I believe the Plasmionique Modbus library is also popular.
Both are available to install through VIPM
If you want to do it the hard way with VISA Serial I recommend watching this video: VIWeek 2020/Proper way to communicate over serial