01-30-2019 01:11 PM
Yes I DID dig into the help, and that's why I'm adding this to this thread because I wonder if the cDAQ card is slow acquiring data.
But I apologize for not providing all the details. The sampling rate is set at 50KHz, and the loop rate is only ~6KHz. So there should be new samples in the buffer every iteration, right?
The reason we used Continuous Samples is that so we don't lose any information once the recording starts.
01-30-2019 04:48 PM
Fair counterpoint. Yes if the loop rate is always slower than the task sample rate, it should always find new samples in the buffer every iteration. The "turning grey and flashing" may have a different cause.
An *error* at DAQmx Read would also return no data, but most task errors would be persistent. Once you get one, every subsequent attempt to call DAQmx Read would keep giving you errors. That doesn't explain "flashing". However, it'd still be good practice to at least notice any such errors that occur. Right now they're being ignored inside the loop (referring again to "Problem 2").
Anyway, let's get back to your original problem/question. It seems you've moved away from the original plan to do a bunch of piecewise Finite Sampling acquisitions and are now intending to do Continuous Sampling. As a result, I think the discrepancy in loop iteration speed should no longer be important. The loop will (should) be paced by requesting some reasonable-sized chunk of samples at a time, let's say 5000 due to your 50 kHz sample rate. (It's kind of a typical place to start - iterate at 10 Hz by reading 0.1 sec worth of samples at a time.)
Further improvements may come from either:
- setting up AO to be hw-clocked and synced to AI
- looping back the AO signal as another channel being captured by AI. Then instead of hardware sync, you post-process to figure out sync in software
-Kevin P