I am using the following example code to continuously output analog signals on channels 0 and 1 of a National Instruments USB-6251 Device. I am using Matlab R2018a.
Every 10 seconds, the queue is filled with 10 seconds of data at 0.5 or 1MHz. The problem is that after an almost fixed number of samples sent (12,884,890,000 +/- 10,000, i.e. after a bit more than 3.5 or 7 hours depending on the sampling frequency), the device stops requiring and outputing data continuously. No error message is displayed, and the porperties of the device after stopping are: ScansQueued: 0, ScansOutputByHardware: 12884899987 (for example) and IsDone: 'true'.
devices = daq.getDevices;
s = daq.createSession('ni');
s.Rate = 1000000;
s.IsContinuous = true;
s.NotifyWhenScansQueuedBelow = 10*s.Rate;
outputSignal = ones(10*s.Rate,2);
lh = addlistener(s, 'DataRequired', @(src,event) src.queueOutputData(outputSignal));
Notice that I tried to manually queue data by calling s.queueOutData every 10 s instead of using addlistener. In this case, there is no error, but no signal can be seen from the analog output ports.
Does anybody has an idea of what is going on?