Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5628

Serial data comes in with delay and in inconsistent batches

$
0
0

Hi everyone,

 

I'm having issues with getting quick, smooth data from a serial device. Data currently comes in large chunks (0-4000 bytes), interspersed by many empty reads, which results in visibly delayed acquisition of data. (Chunks come in at ~4 Hz.) I know that streaming smooth, timely data (at a very high frequency) is possible, because we have a MATLAB Simulink program that is able to achieve this with the same device (using FIFO Read Binary).

 

I'm currently streaming data from a device that sends packet data without termination characters. Each packet starts with [45, 62] and is then followed by seven bytes of data. The attached VI uses a consumer-producer loop. The producer handles serial communication while the consumer is a state machine that identifies headers and then processes them into usable form. I suspect the issue is with the producer loop, but I included the entire subVI for examination. It's currently written to be part of a larger program (stops are linked to a ref and all data goes into a queue).

 

Things I've tried include:

  1. Reading 1000 bytes, with 0 timeout. This results in the same behavior.
  2. Reading 4 or fewer bytes with 10000 timeout. This results in functionally the same behavior as above, except rather than returning empty data, it just waits for a moment before returning a "burst" of reads over many iterations of the producer loop.
  3. Using a timed loop with T=1ms, timeout=1, read 4 bytes. Very smooth data coming in, but very significant lag between device and LabVIEW read data.
  4. Using a timed loop with T=1ms, timeout=1, read 36 bytes. Same as original issue, with "chunky" data stream.

Any advice or help would appreciated. I suspect there's something I'm misunderstanding about serial ports, and could use guidance from y'all.

 

Thanks a bunch!


Viewing all articles
Browse latest Browse all 5628

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>