Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -200279 Analog Input, DAQmx API

I'm writing a plain C application using the DAQmx API. I've modified the sample TDMS-ContAcq-IntClk Example program to give me multiple channels (4 channels in this case).

 

It keeps giving me buffer overrun problems (Error -200279) no matter what. Can any veterans spot the bug?

 

If I increase the buffer, I can at least increase the time before it overflows, but it always does, as suggested by https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KTeSAM&l=en-US

 

This Producer/Consumer pattern may be what I need, but I don't quite see why (since it's a simple single-thread application), nor how to implement it https://www.ni.com/en/support/documentation/supplemental/21/producer-consumer-architecture-in-labvie...

 

Another hint may be that, of what little data I can record, it appears that the channels are not separated properly, and all channels are the same data, I believe channel 0.

 

My code is attached. Any help is greatly appreciated.

 

I forgot to mention- I tried the default XferMech (Transfer Mechanism) of USBBulk, I tried changing it to Interrupts, and then I tried DMA. All give the same resulting buffer overflow.

0 Kudos
Message 1 of 3
(2,776 Views)

Hello  jayache80,

 

When using Text Based emviroments you should try follow some good instructions found here:  https://www.ni.com/en/support/documentation/supplemental/21/using-ni-daqmx-in-text-based-programming...

 

Even if you need some reference about it: https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/cdaqmx/help_file_title.html

 

Even more examples: https://www.ni.com/en/support/documentation/supplemental/20/examples-included-with-ni-software-produ...

 

But you definetely have to consider using a producer/consumer architecture. The error you're getting is related to the buffer size as you can see here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000PAraSAG&l=en-US

The error indicates that information is lost and occurs when LabVIEW does not read data from the PC buffer quickly enough.To avoid an overwrite error, you need to increase the buffer size, read faster, or write slower. 

 

Good Luck!

 

-Andrea G.

Applications Engineer National Instruments

0 Kudos
Message 2 of 3
(2,702 Views)

Thanks, but none of those resources helped me see why my code doesn't work. It seems that on the N-Samples callback, none of the samples in the buffer actually get consumed when they get read. Do I need to manually clear the buffer?

0 Kudos
Message 3 of 3
(2,673 Views)