LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

realtime serial data plotting

Looking at the error out cluster in your jpeg, it appears that your code is exiting the while loop and completing execution without any error.  Try to use highlight execution to double check your while loop stop logic.

You shouldn't have to use any synchronization in LabVIEW for this to work.  Serial is asynchronous communication, and as long as your sending device is not overflowing the buffer, LabVIEW should be able to read all data that is sent.

0 Kudos
Message 21 of 23
(791 Views)
Ok, I have no idea if this will help you, but, the default VISA in-buffer size is 4096 bytes. Since you run LabVIEW on a windows platform (I assume), you might loose/corrupt data when windows does service/thread maintenance/interrupts.

Changing the default buffer size is very easy, and I suggest you try a higher value to see if this can help you out!

The VI to do this with is called "VISA Set I/O Buffer Size" and you can find it in the "instrument I/O"-->"VISA"-->"VISA Advanced" pallette.

Good luck in your project!
---------------------------------------------------

Project Engineer
LabVIEW 2009
Run LabVIEW on WinXP and Vista system.
Used LabVIEW since May 2005

Certifications: CLD and CPI certified
Currently employed.
0 Kudos
Message 22 of 23
(781 Views)
HI M/Ms 12223231,
 
May I call you 12 for short? Smiley Happy
 
There are a lot of potential issues in the example you posted. I would be suprised if this code could run 45 minutes without errors. I will list some suggestions that you can work on, then you can re-post and let us look again.
 
1) The "Wait until next Millisecond..." function will not enusre your code looks at the serial port every 20 ms. It will ensure it never checks the number of bytes at the serial more often than every 20 ms. In a Windows environment, that means most of the time you will NOT find 4 bytes at the port but some other number.
 
That issue can be handled using a shift register to store the extra bytes or the sort messages and only updating your chart when you have a complete set. This would get around the issue of indeterminism in Windows.
 
2) 50 times a second you are going to be adding a point to your chart. At first this may be no big deal, but after you start collecting a pile of data, the chart updates are going to get in the way of your I/O.
 
Search this site for examples of "Producer/Consumer" design pattern. Your data acquisition loop (serial collection) would be the producer. The chart should be in the Consumer loop.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 23 of 23
(775 Views)