01-17-2019 06:22 PM
As shown in the block diagram below, I am trying to use hardware timing on a PCIe-6320 to take single readings (one channel) at a clock rate of 1 kHz. However, I have some evidence that occasional readings are being skipped. To test this, the input is a 500 Hz triangle wave. Suppose the phase is such that the first reading is at the peak of the wave. Then the next reading should be at the bottom trough of the wave. Then peak, trough, peak, trough, etc. Thus if I plot the difference between successive readings, I should get values that alternate between +/- the peak-to-peak value. When plotted as unconnected points, I should then see two horizontal lines. (The obscured vi is "Analog DBL 1Chan 1Samp".)
However, if a reading is skipped, then there will be (for example) two peaks in a row, leading to a difference of zero. This is what I occasionally see, as shown here:
(The lines are not horizontal because the frequency of my signal generator does not exactly match that of the board, leading to an accumulating phase error.)
So my question is: Am I using the right set of vi's to do this? Is there a way with this board to get readings taken accurately according to the board's clock, without missing any readings?
01-18-2019 05:25 AM
Hard to draw firm conclusions from the displayed data, but it sure likes to me like occasional missed samples. It'd help to pay attention to the error out from DAQmx Read, maybe log sample #'s where errors are seen.
The normal way to avoid missing samples is to set the "sample mode" input to DAQmx Timing to either Finite or Continuous Samples. Then the driver manages data transfer from the board over the PCIe bus and you can sustain multi-MB/sec data transfer rates. Using Hardware Timed Single Point puts you at the mercy of Windows for your software loop iteration timing. There, your attempts to request individual samples at 1 kHz appear to be about 99% successful.
Try a shipping example for finite acquisition and then post-process the array of data the same way. You won't miss any samples in the midst of acquisition.
-Kevin P