LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous digital and analog acquisition with data logging

Hi, I'm a graduate student at Tufts University. We are building an experimental apparatus with data acquisition all together.
 
I wrote a VI that reads from 16 Analog input channels and a digital input channel. It also writes to 1 analog output channel and a digital counter channel. I synchronized the tasks with a sample clock which has a rate set to 10000. Since I needed to log all 16 Analog input as well as the one digital, I converted the digital waveform into analog waveform and then built an array from there. This array was then inserted into the 1-D array of analogy waveforms(from my 16 ai). I logged this combined array into a txt file using "Export Waveforms to Spreadsheet File". Now here is my problem:
 
The digital data occasionally do not line up with the analog waveform array in time, causing unpredictable data gaps (see attached txt sample data file).  I discussed this problem with a few colleagues of mine but nobody could make out of anything. We even suspected that maybe it has something to do with the processing power. Please help!!! We were just about to proceed with our experiments when this bug caught our attention.
 
My NI device is PXI-6229, and my LabView version is 8.0
0 Kudos
Message 1 of 6
(3,398 Views)

Hi HTL,

What are you using to combine your waveforms? It seems like you are taking more samples to acquire your digital waveform compared to your analog waveform. Can post a screen shot of your code? It is very hard to debug this without looking at how you are performing your acquisition and how you are combining the waveforms.

 

Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 2 of 6
(3,378 Views)
Hi Abhinav,
Thanks for replying. I use "Insert into Array" function to combine the waveforms. It's really a straightforward VI(see attachment), so I don't see how it can go wrong. Please give me some guidance! Thanks so much.
 
HTL
PS: By the way, I use the same case structure that contains my "Export Waveform to File" to do a little LED indication. The counter channel is actually connected to an LED directly. However, I don't know how to program a constant output (instead of pulses), so I just reset the idle state as my LED switch. But that's not very good because the counter channels always fluctuate even in the idle state(so my LED is flashing a little). Is there a better way to do this? 
0 Kudos
Message 3 of 6
(3,370 Views)
Hi,
 
The one thing I would try is to set the Number of Samples to Read input on each of the DAQmx read functions to be the same. If you do not specify a value there, the read functions will read whatever data is available in the buffer. So if you set those to be something like 100 (on both read functions) you will be able to write the same number of samples on each iteration.
 
Let me know if this helps!
 
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 4 of 6
(3,348 Views)

I just went into NI Measurement and Automation Explorer to check the task settings for the anolog read and digital read. They are both at "continuous" mode with sample to read=100, rate=1k. Is there something else I can try? By the way, I have been getting the same number of analog data as digital data. It's just that they don't line up against each other once in a while. And the occurance of such incidence is pretty random [i.e.  it doesn't occur every certain # of rows].  So it must be some inconsistant processing error that causes this.

In addition, I am getting error code -200279 for the anology read function and the error code -200010 for the digital read function when I'm probing them. But I couldn't find these codes in the Ranges of LabVIEW Error Codes document from NI. Are these special error codes? Can you tell me what they mean?

Thanks

HTL

0 Kudos
Message 5 of 6
(3,335 Views)

HTL,

The code below shows you how to set the number of samples per channel when performing a read. This is an input to the DAQmx read channel.

Message Edited by Abhinav T on 06-18-2007 04:10 PM

Message Edited by Abhinav T on 06-18-2007 04:10 PM

Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 6 of 6
(3,302 Views)