Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I acquire 20 analoge channels and DIG-Port at 2KHz and stream to disk in binary format?

To acquire 20 analoge channels and DIG-Port I use S-Scan.vi + ReadDigPort.vi in a loop. The 1D-array of S-Scan.vi is indexed, data is written subsequently in binary format (2 bytes for each channel) and DIG-Port is added (1 byte) for each sample. It works for 500 Hz but 2 KHz sampling rate causes error -10846. Using AIRead.vi lots of samples are lost. What to do?
0 Kudos
Message 1 of 5
(3,392 Views)
Hello,

From the error here is the explanation and suggestion straight from LabVIEW. Give this a try.

NI-DAQ LV: Your application was unable to retrieve data from the background acquisition buffer fast enough so the unretrieved data was overwritten with new data. To prevent this error, you might increase the size of the background acquisition buffer, increase the amount of data you read from it per call to the read function/VI, slow down your acquisition rate, or reduce the number of tasks your computer is performing.

Good luck,
Doug
0 Kudos
Message 2 of 5
(3,392 Views)
Hi,

thank you for your comment. I read the explanation for the error -10846 before and increased the buffer. The result is that the analoge data is written subsequently but the Dig-Port is written correctly in time. You may try it by a loop which increases voltages in steps and at the same time a counter which is written to the Dig-Port. Therefore analoge and digital data are not synchronous! How to solve the problem?

GreetinX

Andreas
0 Kudos
Message 3 of 5
(3,392 Views)
Hello, Andreas

I assume that you are doing a buffered acquisition (calling AI Control.vi to start the acquisition before the loop). The problem is that you are not reading the data from the buffer fast enough and eventually it will overflow. This is because you read a single scan at a time in a loop where there are other things going on as well (ReadDigPort, write to file). This all takes too much time too keep up with the acquisition, at 2 kHz sampling you have 0.5 ms between scans. You said that using AI Read.vi you lose samples, this is true for the digital data because you would read one digital value every time you read multiple AI samples. However, this is probably your only option to read the buffer fast enough. Also, make sure that you are not doing anything unne
cessary in the loop
Message 4 of 5
(3,392 Views)
Thank you for your reply. It helps me a lot where I have to search for a solution!

I suspected that I can solve the problem only by using AI Read.vi. This means that I have to change my complete setup 😞
My current loop only contains necessary things (only some informations that the system works). So I will have to experiment with AI Read.vi. Would it be useful to program the data aquisition in Visual Basic or C?

Andreas
0 Kudos
Message 5 of 5
(3,392 Views)