LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[LabVIEW 7 Express] Synchronizing intermediate Analog Input VIs

Hi,

I am currently working on a program that scans for a signal continuously into waveforms which then uses the waveforms to create a 2D image.  I have written two versions of the program:

The first program does not scan continuously.  The number of scans is determined primarily by the number of iterations I specify for the program's main loop and with each iteration, the loop calls AI Start.vi and then AI Read.vi, which reads 2000 scans and outputs it as waveform data.  The various waveforms acquired from the multiple scans are then used to create an image.  This program works as desired.

The second program which was meant to be an improvement on the first one reads continuously.  I call AI Start.vi only once (so I avoid the overhead of calling the function multiple times) and have it continuously acquiring data.  I then call AI Read.vi and again, it reads 2000 scans at a time.  The waveform data is sent to a queue and after the specified scanning time has elapsed, the program stops acquiring data and the post-acquisition data analysis takes place and again produces an image.  While this program is MUCH faster than the original one, it doesn't work quite right.  There is always "jitter" in the image, sometimes worse than others.  In the first program, where I see a straight "edge" (ie. if consecutive waveforms have similar peaks), I see a jagged edge on the second program.  Occasionally, the jitter is so bad that we can't use the data.

So here's my conjecture: I think that this has to do with the timing of the data acquisition.  The jitter is due to consecutive scans being slightly offset from each other, the only question is why this is the case.  In the first program, the scan and read are synchronus because I only acquire one wave at a time and in the second program, the data is being continuously acquired so perhaps the "start" of each wave is read differently.  Is there an efficient way of making my data acuisition more regular?
0 Kudos
Message 1 of 4
(2,794 Views)
Hi Dennis,

I'm not sure exactly why you are seeing this type of jitter in the continuous acquisition versus the non-continuous.  Are you sure there is no jitter in the waveform you are acquiring?  The first program is software timed and will start acquiring a new set of data every iteration of the loop.  This induces some "missed" data between loop iterations.  Is it possible that you are just missing the jitter in the first program?  When you set the continuous acquisition with AI start.vi, it will continuously acquire to the buffer.  After the data is acquired continuously, we simply grab chunks of data from the buffer using the AI Read.vi.  As long as you are reading properly, you should be getting all the data that has been read in continuously to the buffer. 

Could you provide a picture of the two signals?  In addition, have you tried using one of our example programs, such as the Cont Acq&Graph (buffered).vi, to verify you're reading in the data properly in the second program.

Could you provide the name of the DAQ card you are using and what DAQ driver version?

The continuous acquisition should be making your data more "regular".  In addition, there shouldn't be any delay or offset between consecutive scans in a continuous acquisition.  If you would like to understand more about how buffering works in Traditional DAQ, I would recommend taking a look at chapter 4 of the Traditional NI-DAQ (Legacy) User Manual (Found in Start » Programs » National Instruments » NI-DAQ).

Thanks,
Paul C
0 Kudos
Message 2 of 4
(2,774 Views)
Hi Paul,

Thank your quick reply.

I've attached a picture of the two separate images.  The "good" scan producs nice straight edges (much like the surface of the object we are scanning), but the "bad" scan introduces some jitter to the surface as one can see.  The images might be a little offset sideways because I cropped the scans, but my main problem is with the edge artifacts.  I've also attached a sample picture of the waves that were used to create a single "line" in the images.  The waves are superimposed on each other.  As you can see, the peaks are a little offset from one another. 

The DAQ device is a PCI-6111 and the DAQ driver version is 1.9.0f0 according to my windows device manager.  Our program is a bit more complicated than the example program you've mentioned but the main acquisition loop in the program is very similar.  It's confusing to me that the problem is so random.  If it were a coding error, I would expect the error to be a bit more deterministic but the final images vary greatly in quality.

Thanks,
Dennis
Download All
0 Kudos
Message 3 of 4
(2,762 Views)
Hi Dennis,

After looking at the images, I can see a small amount of "jitter" or non straight edge lines on the top of the bad scan image.  You said that you were taking in waveforms and then using them to form a 2D array.  Are you reading the voltages of some type of sensor?  Is it possible that because you were doing multiple scans in the first program they were being averaged together to produce the first image?  In addition, I'm having a little trouble visualizes how you are using what you're reading into the DAQ card to produce these images.  Could you explain this a bit more? 

I don't see how there would be any difference in the samples collected during a continuous scan vs. a non-continuous scan except for the gaps that would appear on non-continuous.  Could you tell me how fast your scan rate is?

Thanks,
Paul C.
0 Kudos
Message 4 of 4
(2,740 Views)