LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Read Timeout (-1073807339) in Modbus RTU when combining multiple commands (Flow Control + Pump ON/OFF)

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:

  1. Frame 0: Flow Rate Control (VISA Flush -> Write -> Wait 500ms -> Bytes at Port -> Read)

  2. Frame 1: Wait (1000ms) for device stability.

  3. Frame 2: Pump ON/OFF Control (VISA Flush -> Write -> Wait 500ms -> Bytes at Port -> Read)

    dingding_0-1765776928191.png

    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.

     

0 Kudos
Message 1 of 3
(273 Views)

Hi dingding,

 


@dingding wrote:

 

dingding_0-1765776928191.png

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(248 Views)

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

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 3
(180 Views)