Good Afternoon All,
I'm working on a measurement where I'm trying to sample an analog input from a photodetector onto a USB-6363 NI DAQ card. The input needs to be precisely timed relative to a pulse train of instructions from a Pulse Blaster (down to hundreds, or ideally tens of nanoseconds). Originally measurements were taken by instructing the NI DAQ to acquire at a given time using the acquire() function for an AnalogIn device as described in line 1732 of labscript.py, for a single data point every time (corresponding to a 1 microsecond acquisition window)
Unfortunately, the PB and NI DAQ have a mutual clock-drift of about 150ppm. As a result the sample clock in the NI DAQ would slew by about 1 microsecond over the course of a large number of measurements. As best I understand it the AI Start Trigger was being triggered by the PB (at the appropriate window) but the AI Sample Clock of the NI DAQ was moving around, causing a 1 microsecond drift that cannot be accurately compensated. (as described in page 4-45
of the NI DAQ X series manual)
To correct this I'm attempting to replace the AI sample clock of the NI DAQ with a series of pulses I have direct control over from an additional PB digital out channel. I've done this by replacing line 488 of NI_DAQmx\blacs_workers.py:
"", rate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, num_samples
'/NI1/PFI2', rate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, num_samples
Where /NI1/PFI2 is the channel to which I am sending digital pulses (1 microsecond long). Unfortunately I get the "No data was acquired. Perhaps the acquisition task was not triggered to start, is the device connected to a pseudoclock?" error which indicates that the acquisition did not properly resolve. (The NI DAQ card then needs to be manually rebooted in blacs) If I attempt the same acquisition with the original Sample Clock code the acquisition completes normally, indicating that this is the source of the problem.
So far I've attempted sending a single 1-microsecond ttl pulse through /NI1/PFI2 at variable delay, as well as a "500KHz-like" pulse train of on-1us off-1us on-1us [...] pulses.
An example experiment would look something like the following:
t = 0
analogOne.acquire( 'output_file_name', start_time = t, end_time = t+1e-2)
for dummyVal in np.arange(0,1001):
t += 0.1
stop(t + 1e-3)
the above would be an example of a pulse train, where Misc_ttl is the digital output of the PB sending a signal to /NI1/PFI2, and analogOne is the analog input channel which should be triggered by the PB clock signal.
Thanks in advance for any insight provided.