From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial VISA Overrun Error 1073807252

Hello,

 

I'm attempting to read a stream of serial data at a baud rate of 9600. I've attached the main VI (FAV-1 Flight Testing Data Recorder_serial) in addition to the subVI's for that program. The DAQmx functions all work perfectly - I'm just debugging the serial read and write to file functionality. 

 

I receive the error AFTER I press the stop button and the program has been running for more than a few seconds. I do not get the error when the program has only run for 3 or 4 seconds. So far, the error hasn't terminated the program prematurely but as with any buffer-related issue I suspect that it will after the program has been running for a while. 

 

I've implemented the advice on other forums for correcting this error including:

- using producer/consumer architecture

- ensuring that the serial settings match the serial device

- using the terminating char functionality 

 

I've also read that I can manually increase the buffer size, but the default value is 4096 bytes. The device producing the serial data is sending three streams in a continual rotation: one data stream of 225 bytes, one that is 93 bytes, and one that is 74 bytes so the current buffer value should be plenty large enough.

 

Any advice would be greatly appreciated.

 

Thank you!

 

0 Kudos
Message 1 of 7
(2,941 Views)

OMG: I hate to sound mean but you need to just throw this out and start over with a proper program architecture.

 

One Big Loop (OBL) is never a good program architecture. I know NI makes it look like that's the only way to write a LabVIEW program in their training. But that's because all the training programs are very simple.

 

Just fixing your serial overrun would be analogous to putting a band-aid on a bullet wound.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 7
(2,923 Views)

Your comment isn't mean, just unhelpful.

 

What changes would help make this program better? Putting each DAQmx read in it's own separate producer loop and/or it's own subVI? Put the consumer loop in a separate subVI?

 

Thanks,

 

Sheila

0 Kudos
Message 3 of 7
(2,895 Views)

There is just so much wrong...

 

For instance this:

JustWrong.png

 

Could be replaced with this:

Better.png

I don't have a DAQ so the DAQ I/O array constant did not populate properly.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 7
(2,877 Views)

Thank you for taking another look and clarifying. That is an elegant solution if each strain gauge had the exact same gage factor, resistance, poisson ratio, etc., which it does in this program only as a placeholder until the gauges arrive.

 

You alluded to the fact that having all the data collection occur in one big loop is not good. I split out all the DAQmx Read vi's and the serial read vi into their own producer loops with a 50ms wait, which solved the overrun error issue (for now at least - I haven't run this for more than a couple minutes). 

 

 

0 Kudos
Message 5 of 7
(2,870 Views)

Sure, but it's nothing to add another array constant or two for the parameters that are different. Imagine a larger setup where these values are read from a file. You would read the file once and put all the  values into an array, then feed that array to a loop like this...

 

A lot of this code can be refactored as I have done with that one part. Look for repetitive tasks where only one or two parameters change and put them, in a loop.

 

I see you attempted some sub-vi's but more of this could be done.

 

It is a very common thing to try to keep your code small and neat so you can see it all on one screen. When it starts growing and you are constantly scrolling left, right, up, and down then it's time to start refactoring and simplifying.

 

Also next time you post a VI with lots of sub-vi's zip them all into one file and upload it. 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 7
(2,865 Views)

I keep getting over run errors, please help!!!

0 Kudos
Message 7 of 7
(1,866 Views)