Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read the FIFO correctly on an M series DAQ card?

I have a PCI-6229, which I have working with the exception of a bug or two.  The program continuously reads multiple inputs from the FIFO buffer, which is being filled at around 100 kHz.  Every ms or so, the program reads all the values in the FIFO.  To keep track of the input channel being read, the program currently indexes a channel variable every time it reads a value from the FIFO and continues until the FIFO is empty.  The next time it starts reading the FIFO it continues from the last input channel read.  This works correctly sometimes, but other times the tracking system gets off by one then associates the values with the wrong input channels.

As an example, reading two inputs at 100 kHz the DAQ card appears to read one input every 5 microseconds and put that value in the FIFO.  When the program reads, sometimes it reads an even number of values and other times an odd number.  The program tries to keep track of this, but several unmonitored variables that I'm aware of and several that I'm probably not aware of can lead to my tracking error.  The FIFO filling up is one example, I believe.  Many times when the card is started it is already off by one.

Is there a way to know what input a value in the FIFO is associated with?  I'm trying to have the DAQ card run continously, empty the FIFO periodically, process the data, and continue this process.  I don't want to start the AI task for 1 ms, read the values, process the data, and restart the AI task for 1 ms if I don't have to.  Thanks.

Aaron
0 Kudos
Message 1 of 2
(6,945 Views)
You could try using DMA. This thread has a code example and some corrections. I did not have to delete the acdReset, but your mileage may vary.

Good luck

Neil

0 Kudos
Message 2 of 2
(6,910 Views)