Hello Preetam,
The error message you are getting is due to a buffer overflow. Basically, you are not reading values from the buffer fast enough and previously acquired samples are being overwritten.
I took a quick look at your code, and it looks like this is happening because you are trying to write all of the data to file in the same loop in which you are reading from the buffer with DAQmx Read. You are reading 600,000 points on three channels, so 1,800,000 total points. Each of these is a double-precision, floating point number which is 8 bytes long. This corresponds to 14,400,000 total bytes, or ~13.73 MB of data. Writing such a large chunk of data to file in your loop can drastically slow down your loop rate resulting in an overflow error.
There are two possible approaches to improving the performance of your code. One approach would be to acquire all of the available samples rather than a fixed number of samples on each channel (600,000). This can be done by wiring a constant of
-1 to the
number of samples per channel input to DAQmx Read. This would allow you to "catch up" to the total number of samples that have been transferred from your DAQ board to the PC memory. Using this approach, I would suggest that you decrease the number of samples that are read with each iteration. This will decrease the likelihood that your buffer will overflow after only one iteration of the loop.
The second approach would be to use a producer/consumer design pattern with the File I/O portion of your code in the consumer loop. This would allow the data acquisition portion of the code to run at the maximum rate, reducing the chance of a buffer overflow. For more information on using producer/consumer loops, please refer to
Application Design Patterns: Producer/Consumer.
I hope this information helps!
Best regards,