03-10-2025 05:34 AM
Hello,
I've a NI-9263 module to generate output signal.
I would like to know if there is some kind of progress value ?
I've tried EveryNSamplesWritten event but I've this message :
"NationalInstruments.DAQmx.DaqException : 'Requested Every N Samples Event Interval is not supported for the given Data Transfer Mechanism and buffer size.
To keep DMA or USB Bulk as the Data Transfer Mechanism, modify the buffer size and/or the Every N Samples Event Interval so the buffer size is an even multiple of the Every N Samples Event Interval. To keep the same Every N Samples Event Interval and buffer size, change the Data Transfer Mechanism to Interrupts if supported."
Thx.
03-25-2025 10:16 AM
Hello Flow75,
Before being able to help you, there are a few questions that I have:
By giving us more details, it's going to be easier for us to help you ! 😉
03-28-2025 02:48 AM
Hello,
I'm developping a c# software with the Daqmx framework on win 11
For the hardware, We use a NI cDAQ-9174 with the NI-9263 output module.
I've send my signal array with the sampling frequency to the buffer but I want to be able to display the signal progression like with a progress bar.
04-07-2025 04:27 AM
Hello Flow75,
You're encountering an exception related to the EveryNSamplesWritten event because the Data Transfer Mechanism (DMA, USB Bulk, or Interrupts) imposes constraints on the buffer size and the sample interval.
You have here two different options to solve this issue:
To do this, you can take inspiration from the small code snippet structure below.
while (written < totalSamples)
{ int remaining = totalSamples - written;
int currentChunk = Math.Min(chunkSize, remaining);
double[] buffer = new double[currentChunk];
Array.Copy(signal, written, buffer, 0, currentChunk);
writer.WriteMultiSample(false, buffer);
written += currentChunk;
Console.WriteLine($"Progression : {written * 100 / totalSamples}%");
Thread.Sleep(100); // <-- Simulate the regular interval }
However, while this method provides a practical workaround, it is not true hard real-time. Still, it’s often sufficient for generating simple analog signals.
If you’re working with a high sampling rate, you’ll also need to adjust both chunkSize and Thread.Sleep() to avoid underfeeding the device.
However, be aware that not all modules and configurations support this approach (which is what your error message is indicating), so in many cases it's better to rely on your own progress logic, like in the first method using chunkSize.