LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timing problem during daq

Hello,

I have following problem:
I want to acquire samples and write them with a timestamp (hh:mm:ss) to
a file (spreadsheet). It is very important fo me to have a constant
samplerate, so I set the scanrate (AI START.vi) to 1000 per sec. and the
number of scans to read from buffer (AI READ.vi) to 10. I calculated the
mean of this 10 scans and write the value to the file.
But when I looked into my spreadsheet-file, the number of scans is not
constant (100 per second).
Why?

Thanks,
Hans
0 Kudos
Message 1 of 4
(2,774 Views)
If you are calculating the time stamp in the moment in which you store a reading, this can be irregular due to other activities in the same or other vi or in the computer itself that can affect the execution time of your vi.

The activity of an acquisition card is indipendent from the PC because it is managed by an internal hardware timer.
So the best is trust the DAQ card and calculate the actual time stamp from the beginning of the process by using the 'actual scan rate' output by AI Read.vi.

You can accumulate every 10 readings a value calculated as follows:

inverse of actual scan rate * 10 (in secs)

So you can accumulate progressively that value over the initial time (in secs).
That's the way NI calculates the timestamp column in Export Waveform To Sp
readsheet File.vi; look also at Get Waveform Time Array.vi for an example of how to do it.

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(2,774 Views)
> That's the way NI calculates the timestamp column in Export Waveform
> To Spreadsheet File.vi; look also at Get Waveform Time Array.vi for an
> example of how to do it.

Thank you for this tip.
In which library can I find this VIs?

Hans
0 Kudos
Message 3 of 4
(2,774 Views)
Those vis are located in Function>>Waveform>>Waveform File I/O and Functions>>Waveform>>Waveform Operations palettes.
Get Waveform Time Array.vi is located in vi.lib\waveform\WDTOps.llb, while Export Waveform To Spreadsheet File.vi is located in vi.lib\waveform\WDTFileIO.llb
This is with LabVIEW 6i.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(2,774 Views)