LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Change Sampling Frequency with Data Logging

Solved!
Go to solution

Hello community,

 

I'm slightly embarrassed to post this because my issue seems trivial, but I cannot find the information to point me in the right direction. I'm fairly new with LabView and I am currently working through the Core I lessons provided by NI. I've made slight modifications to VIs in the past, but now I'm beginning to create my own.

 

I'm trying to increase the sampling rate of the my measured data and record it to a file, and I have the following two concerns:

 

1) Current sample/record rate is ~1Hz, and the goal is to bump it up to 10Hz. I'm having trouble understanding where or how I implement such a change.

 

2) I currently have the VI setup to record into an excel file using the Write To Measurment File VI; am I limiting the speed at which I can record data based on my file choice?

 

Any other tips/advice/suggestions you have based on the provided code is encouraged and appreciated. I'm here to learn.

 

 

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

Hi imhere,

 


@imheretolearn wrote:

1) Current sample/record rate is ~1Hz, and the goal is to bump it up to 10Hz. I'm having trouble understanding where or how I implement such a change.

 

2) I currently have the VI setup to record into an excel file using the Write To Measurment File VI; am I limiting the speed at which I can record data based on my file choice?


  1. To change the sample rate of a DAQmx task you need to stop it, change the DAQmx timing, and start the task again. It seems much more simple to setup the task with 10S/s right from the beginning and decimate the data as needed…
  2. Yes. Using ExpressVIs most often is not the way to create "fast and smooth" applications. And using WriteToMeasurementFile with the option to create an Excel (XLSX) file is begging for speed limitations! You can have DAQmx do the logging (to TDMS files, which you can open in Excel too). You can write simple CSV file (aka spreadsheet files aka delimited text file). You can use a producer-consumer scheme to decouple DAQ from file access routines…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(2,382 Views)
Solution
Accepted by topic author imheretolearn

You need to add a DAQmx Timing VI after you have added your channels to the task.

 

This example shows how you can acquire continuously.

C:\Program Files\National Instruments\LabVIEW 2020\examples\DAQmx\Analog Input\Voltage - Continuous Input.vi

 

Of particular note, create the task, set timing, start before the continuous acquisition loop; read in the loop; and stop and clear the task after the loop when done. That example also implements DAQmx logging to TDMS Files.

 
 
 
 

 

Doug
NI Sound and Vibration
Message 3 of 7
(2,369 Views)

GerdW,

 

Poor planning of what my needs were led to an insufficient setup.

Thank you for the insight!

0 Kudos
Message 4 of 7
(2,350 Views)

dsb@NI,

 

You're explanation and comment was very helpful. I was able to input the recommended changes and now I can easily adjust the sampling rate. Thank you!

 

I attached my updated file for anyone that may be interested.

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

 I download the VI to try it but I do not think we can set the sample rate correctly in the data logger. save to .Xlsx is alway 1 second

0 Kudos
Message 6 of 7
(1,482 Views)

Please start a new thread for your question. When you post, please include as much detail as possible: what are you observing, what are you expecting, CODE, data file, what have you already tried changing, etc.

Doug
NI Sound and Vibration
0 Kudos
Message 7 of 7
(1,470 Views)