I am trying to set up a USB-6001 to send a pre-programmed sequence of TTL pulses on software command. I am doing the programming in Python (via nidaqmx library). However, I can't seem to be able to set the rate for the sample clock. I'm able to set up a task and change the state of a pin by command, so I know everything is loaded correctly, at least.
>>> task_do.do_channels.add_do_chan('Dev1/port0/line0')
DOChannel(name=Dev1/port0/line0)>>> task_do.do_channels.add_do_chan('Dev1/port0/line1')
DOChannel(name=Dev1/port0/line1)>>> task_do.write([True, True])
1 #I can observe pins turning on>>> task_do.write([False, False])
1 #I can observe pins turning off>>> task_do.timing.cfg_samp_clk_timing(rate = 1000)
Traceback (most recent call last):
File "<pyshell#28>", line 1, in <module>
task_do.timing.cfg_samp_clk_timing(rate = 1000)
File "C:\Users\bglebov\Python36\lib\site-packages\nidaqmx\_task_modules\timing.py", line 3007, in cfg_samp_clk_timing
check_for_error(error_code)
File "C:\Users\bglebov\Python36\lib\site-packages\nidaqmx\errors.py", line 127, in check_for_error
raise DaqError(error_buffer.value.decode("utf-8"), error_code)
nidaqmx.errors.DaqError: Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.
Property: DAQmx_SampTimingType
Requested Value: DAQmx_Val_SampClk
Possible Values: DAQmx_Val_OnDemand
Task Name: DO test
Status Code: -200077
From what I understand, I need to set the clock before setting up the waveform. For this, I'd like to use the internal clock of the USB-6001. The spec sheet defines the timebase frequency at 80 MHz, and max sample rate at 20 kHz. However, I get the above error for any rate value. (Just for kicks, I also tried passing a string for rate value, and it came back with a different error - so it's not a type error, at least.)
Does USB-6001 even have an internal clock reference, or does it have to us an external one? If so, how do I set this up?
Also, assuming I can set this up, would the sequence fire off whenever I run task_do.start()? I couldn't find a setting for a software trigger.