LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Serial Communication (38400 baud, 100Hz): RX/TX timing issues, UI freeze, and VISA session problems(VI file is updated)

System Overview

I am developing a LabVIEW application that communicates with an external device over serial.

Baud rate: 38400
Receive: 5 bytes at 100 Hz
Transmit: 4-byte ACK for every received packet
UI: Displays parsed data (LEDs, switches, graphs)
Control: Connect / Disconnect buttons to open/close the serial port

 

The requirement is:

Reliable 1:1 RX → ACK response
Stable UI updates
Clean connect/disconnect behavior (no freezes, proper VISA release)


Initial Implementation (Event Structure-based)

Initially, I implemented everything inside a single while loop using an Event Structure:

Button events (connect, disconnect, send commands)
Timeout event used for:
VISA Read
Packet parsing
UI updates
VISA Write (ACK)


Problems:
TX packets are grouped (e.g., 3 ACKs sent at once)
Timing is inconsistent

Possible causes I suspect:

1. Loop condition or structure issue(event structure)
2. UI Freeze and Event Blocking
When debugging, execution often pauses inside the Event Structure
Timeout events seem to block other UI events
UI becomes unresponsive
3. TX Timing Still Not Perfect

Even with separated TX loop:

ACK packets are sometimes sent in bursts rather than evenly
Possibly due to USB-Serial buffering or loop timing
What is the best way to safely handle

image.png

I fixed the vi file due to my fault.

0 Kudos
Message 1 of 2
(85 Views)

I cannot open your vi because I don't have LV2025 installed, like many people in this forum (can you Save for previous... at least to LV2021 or earlier and re-post?).

However, using an event structure may not be the right choice for this application. LabVIEW may freeze if you interact with the UI elements while the structure is not in the execution path. Furthermore, you need to pay attention to the structure's Timeout setting. Why not using a simple polling for buttons?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 2 of 2
(46 Views)