11-11-2024 05:04 PM
I have a setup of NI-9205 with cDAQ-9178. I am using "continues" analog read of 4 channels at 12kS/s (48kHz ADC rate). I noticed when I am trying to get AvailSamplPerChan task property I am getting 4096xN (where N=0, 1, 2 ...) samples and never any number between 0-4096. With given 12kS/s it ends up with ~300ms before I can update measured value.
Is there any way to improve timing? Something about 10ms will be great. It seems it is not about amount of data needs to be transferred over USB, but just about the packet size cDAQ transfers. I found I can improve time up to certain level by increasing sample rate to 60kS/s, even though I was absolutely fine with 12kS/s. I am wondering if there any way I can control how often cDAQ transmits data over USB. Will it work if I will request to read let say 120 samples, or it still be waiting for entire 4096 buffer to be ready?
11-11-2024 05:32 PM
Without seeing your implementation, I would bet that you are complicating the code more than it needs to be.
In short, when you need to continuously acquire data, do not query for available samples, instead, pass it the number of samples you need to the DAQmx Read API, this way as soon as those many samples are available the read API returns, a rule of thumb is read 10% of sample rate, i.e., if you're acquiring at 12kS/s, pass 1200 as samples to read to the Read API or if you want faster read 600 samples.