Simultaneous digital and analog acquisition with data logging

Simultaneous digital and analog acquisition with data logging

Post by HTL » Thu, 14 Jun 2007 08:40:09


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


06.12 test.txt:
http://www.yqcomputer.com/
 
 
 

Simultaneous digital and analog acquisition with data logging

Post by HTL » Fri, 15 Jun 2007 09:40:07

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? 


MFBA_3.vi:
http://www.yqcomputer.com/

 
 
 

Simultaneous digital and analog acquisition with data logging

Post by Abhinav » Sat, 16 Jun 2007 10:10:08

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!
 
 
 
 

Simultaneous digital and analog acquisition with data logging

Post by HTL » Sat, 16 Jun 2007 23:10:11

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
 
 
 

Simultaneous digital and analog acquisition with data logging

Post by Abhinav » Wed, 20 Jun 2007 06:10:09

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.