I'm writing code to write digital pulse signals to 6 lines on the NI 9403 via the DAQmx Python API. The code looks something like this:
waveform = [some_data]
my_task = Task()
my_Task.add_do_chan(lines = f"some lines")
my_task.cfg_samp_clk_timing(rate = 100000, sample_mode = AcquisitionType.CONTINUOUS, samples_per_chan = len(waveform[0]))
my_task.control(TaskMode.TASK_COMMIT)
my_task.write(waveform)
my_task.start()
The length of the waveform is about 2000 samples. The waveform will be generated continuously. I then have a button with a call-back to another function
def button_pressed():
my_task.write(some_other_waveform)
When I press a button, this new waveform will be generated, but only after 20 seconds or so.
Why is this latency so high? Should I change the buffer size? What can I do to improve performance?