LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx timing and Writing to measurement

Hi guys. i'm having a very strange problem with my labview code and my DAQmx block. i set the sample rate to 1kiloHz then i write to a mesurement but if i let the acquisition running for 1 second i dont get 1000 samples in the txt file. what could be the reason??

0 Kudos
Message 1 of 10
(4,174 Views)

Hi Cargio,

 

can you give us some more information and maybe attach your VI?

 

What is the number of samples in your file? Did you set the correct number of samples to be read?



Remember Cunningham's Law
0 Kudos
Message 2 of 10
(4,163 Views)

Hi cargio,

 

what could be the reason??

Most probably your VI!

 

Mind to attach your VI here so we can examine what you have programmed?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 10
(4,161 Views)

Here is my VI. thank you in advance

0 Kudos
Message 4 of 10
(4,125 Views)

The DAQmx Timing vi Sample Mode is set to Finites samples and Samples by Channel input is set to 20. You will then acquire 20 samples by channels. Set the sampling rate to 1k and the samples by channel to 1k to acquire 1000 samples for each channel.

 

Ben64

0 Kudos
Message 5 of 10
(4,117 Views)

It seems not working. now it only write 1 value because this way  ( as i expected) in 1 seconds he acquires 1000 samples ( sample rate : 1000hz)  than he makes the average of 1000 samples ( mean operation after the data file of N samples)  obtaining a single number.

 

Could it be the writing operation being too slow? should i use the queue?

0 Kudos
Message 6 of 10
(4,110 Views)

Sorry, I misread your question. Usually samples are the result of the acquisition, not the processed data.

 

Yes you should use a queue and you should use continuous acquisition mode. Only the DAQmx Read.vi and the Enqueue vi should be in the acquisition loop. Have a look at the Voltage-Continuous Input.vi from the LabVIEW exemples (Help - Find Examples... Hardware Input and Output - DAQmx - Analog Input)

 

Ben64

0 Kudos
Message 7 of 10
(4,100 Views)

OK. it´s good with the writing but then how can i do with the meaning operation?

0 Kudos
Message 8 of 10
(4,094 Views)

As far as I can see your program behaves logically...

You acquire 1000 samples and calculate the mean value of them which gives you one value.

The question is: What do you want? 1000 samples or the mean value?

 



Remember Cunningham's Law
0 Kudos
Message 9 of 10
(4,077 Views)

Do it in the consumer loop (when you dequeue the acquired data). All the processing and writing to file shoulb be in the consumer loop. I assume you are familiar with producer/consumer design pattern since you know about queues. If you're not have a look at the Producer/Consumer (data) desing pattern from the menu: File - new... VI - From Template - Frameworks - Design Patterns.

 

Ben64

0 Kudos
Message 10 of 10
(4,072 Views)