this is my first post, so please bare with me.
My Situation: I am trying to write a python programm to read_out an analog signal from a diode, while also writing an analog voltage to a device, by using a national insturments card. A very simple approach can be:
import nidaqmx
task_1 = nidaqmx.Task()
task_2 = nidaqmx.Task()
task_1.ao_channels.add_ao_voltage_chan(channel_name1, min_val= -2, max_val=10)
task_2.ai_channels.add_ai_voltage_chan(channel_name2)
task_1.start()
task_2.start()
values1 = np.zeros(steps)
values2 = np.zeros(steps)
for i in range(steps):
values1[i] = i
task_1.write(i)
values2[i] = task_2.read(1)
task_1.close()
task_2.close()
# Followed by later plotting
plt.plot(values1, values2)
My Problem:
I would like to have more readouts, as the programm is not as fast as I wish it to be. I tried multithreading to separate readout and writing (and to read out continously), and also tried the "reader.read_many_sample" functionality, but this requires me knowing how many samples I want.
What I look for
I am looking for a solution to apply a output signal (like a ramp scan) and continously aquire data points (e.g. the readout). After the ramp is finished, I want the readout to stop and access the data points. But I want the start and end of read/write to be synchronous.
Thank you in advance!