Hello averyone !
So I have two different PWM and I'd like to send one through one DO of my ni9401, and the other one through another DO of my NI9401 (and read the first one with one DI and the other one with another DI).
I'm using Python, and I already know how to create a multichannel task (with cDAQ)/Mod1/line0:4 for example), but after that, how do I tell it to write one PWM through only one of theDO and the other PWM through another DO. And I must write those at the same time.
So first, is it possible ? If so, I'd be glad to have some help.
Thanks in advance.
Below is my code, where sig_e1 and sig_e2 are my two different PWM to be wrtitten through two DO, and sig_r1 and sig_r2 are the same PWM but after being read by two different DI.
I tried to create one master task with 2 slave tasks (well, I tried something...).
with nidaqmx.Task() as master_task, nidaqmx.Task() as slave_task1, nidaqmx.Task() as slave_task2: master_task.di_channels.add_di_chan("cDAQ1Mod1/port0/line4:5") master_task.control(TaskMode.TASK_RESERVE) master_task.timing.cfg_samp_clk_timing(int(fe), sample_mode=AcquisitionType.CONTINUOUS) slave_task1.do_channels.add_do_chan("cDAQ1Mod1/port0/line0") slave_task1.control(TaskMode.TASK_RESERVE) slave_task1.timing.cfg_samp_clk_timing(int(fe), sample_mode=AcquisitionType.CONTINUOUS) slave_task2.do_channels.add_do_chan("cDAQ1Mod1/port0/line1") slave_task2.control(TaskMode.TASK_RESERVE) slave_task2.timing.cfg_samp_clk_timing(int(fe), sample_mode=AcquisitionType.CONTINUOUS) slave_task1.write(sig_e1) slave_task1.control(TaskMode.TASK_COMMIT) slave_task2.write(sig_e2) slave_task2.control(TaskMode.TASK_COMMIT) master_task.control(TaskMode.TASK_COMMIT) slave_task1.start() slave_task2.start() master_task.start() sig_r1, sig_r2 = master_task.read(number_of_samples_per_channel=len(sig_e1)) slave_task1.stop() slave_task2.stop() master_task.stop()