LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unstable Sampling frequency in Text file

Hi every body,

 

Wish you all a happy and bright new year.

I am reading signal through Serial port.  When I am trying to save my file into text file Sampling frequency is changing and it is not constant while device is sending 1 frame every 10 MS.

First I faced a problem that time stamp was repeating for some points while signal kept changing.

I solved that problem by putting a case structure and time delay function for about 1 MS and it is solved. Even though I am not sure this make program miss the data or not. Device is sending every 10 ms one frame.

 

Thanks for your help.

 

Download All
0 Kudos
Message 1 of 2
(2,210 Views)

Hey Mahb,

 

It looks like you will miss data as you are reading data and the buffer is overwritten if not read. You will need to make a queue action to get around this. In this case you can have two parallel loops running at different rates. Which will make you able to catch all data and queue it for your consumer loop.

 

Take a look at Producer/Consumer Design Pattern (Data), under File>>new... in LabVIEW.

 

However you need to make sure that your computer is running the program that fast so that no data is missed. Also implementing queues you need to figure out a new way to handle the time stamps when you enqueue elements. As you are doing this software timed and the time date is not shared over the serial communication you will not have the real time for the sampling of your data only an estimate from your computer. This will vary as Windows is not a deterministic operating system. With timing you can get it to vary less.

 

Best regards

Jonas

Best regards
JM, LabVIEW CLA
0 Kudos
Message 2 of 2
(2,166 Views)