LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Better way to wait for serial data?

I have a device that does not respond to any sort of query but rather spits out a serial data stream every five minutes under normal conditions and every 30 seconds if there is any alarm conditions.
 
I am working in a vi to capture this data and have a loop that waits for serial bytes. This vi seems to bog down my computer and makes it usless to do any other tasks while I am running this test. I am guessing because it is constantly checking the serial port?
 
Is there a better way?
 
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 5
(4,028 Views)
While loops (of any type) without any delay in them will cause this. If you simply put a msec wait in there it should improve things quite a bit. You probably don't need to check more often than every 250 msec or so.
0 Kudos
Message 2 of 5
(4,017 Views)
I don't know if this helps but this is what I do.  I have a program that runs a main while loop and I have an external while loop that just monitors the serial port.  When data appears in the buffer it reads the buffer until all data is input.  Then it signals a control called read buffer and the main vi gets the signaled data and performs a function on it.
0 Kudos
Message 3 of 5
(4,013 Views)
try using events
 

Message Edited by James R on 03-30-2007 11:40 AM

- James

Using LV 2012 on Windows 7 64 bit
Download All
0 Kudos
Message 4 of 5
(4,012 Views)

Oh my    Using Events is way beyond my abilities.

Last training I had for Labview was entry level LV 5.1

Just a couple months ago we jumped from LV 5.1 to LV 8.2.Smiley Surprised

I added a ms wait as suggested and it seems to work better that way.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(3,991 Views)