10-20-2021 03:12 PM
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.
10-20-2021 04:19 PM
The USB-6001 only supports *static* DIO, not hw-clocked and buffered DIO. So you can't use a buffer or set a sample rate. This remains true even if you supply an external clock. (The 20 kHz max sample rate you found applies to AI).
Depending on the sequence, you *might* be able to do it with AO instead. Max rate there is 5 kHz so your pulse timing would be limited to 2 millisec resolution.
-Kevin P
10-20-2021 04:47 PM
Hm. Thanks for clearing that up. Well that's rather disappointing. And not entirely clear from either the spec sheet or the manual. Unfortunately, I was already planning to use the analog outputs for something else, so that's a no-go.
Do any of the other USB-600x models support clocked and buffered digital outputs? I'm looking for something in this form factor. If I end up using something much bigger (like, a cDAQ module), I might as well use a programmable function generator, which I already have.
10-20-2021 06:35 PM
You definitely have to go for something better than USB-600x for dynamic DIO.
All USB-600x only support static DIO.
10-20-2021 08:15 PM
The spec sheet *is* fairly clear about only supporting "static" DIO, but I recognize that while the *meaning* of static DIO is plenty clear to me who's been around NI stuff for 20+ years, it may not be so clear to anyone who isn't already accustomed to the jargon.
-Kevin P