Quantcast
Channel: Digital I/O topics
Viewing all articles
Browse latest Browse all 2181

Digital output timing possible with NI621X?

$
0
0

I have an NI6215 DAQ that I'm trying to use for simultaneous analog and digital I/O.

 

The analog output requires precise synchronization, so I'm using hardware timing.

I want to simultaneously output a digital signal that uses the same sample timing.

I have a generic example below, but really I want to output a digital rising edge every time the analog voltage changes.

 

I'm able to use software timing to control the digital output, but all attempts at hardware timing have failed.

 

 

# Set up bit stream num_bits = 200 bit_sequence = np.random.choice(a=[False, True], size=num_bits) bit_time = 0.2 # seconds sample_freq = 5 # Hz print(bit_sequence) # Set up marker task marker_task = nidaqmx.Task() marker_task.do_channels.add_do_chan("Dev1/port1/line2") # set up analog output for hardware timing ao_task = nidaqmx.Task() ao_task.ao_channels.add_ao_voltage_chan("Dev1/ao0") ao_task.timing.cfg_samp_clk_timing(sample_freq, samps_per_chan=num_bits) ao_task.write(np.zeros(num_bits), auto_start=False) # Set up marker task timing marker_task.timing.cfg_samp_clk_timing(rate=sample_freq, source='ao/SampleClock', samps_per_chan=num_bits) marker_task.write(bit_sequence, auto_start=False) marker_task.start() ao_task.start() marker_task.wait_until_done() ao_task.wait_until_done() marker_task.stop() ao_task.stop() marker_task.close() ao_task.close()

 

 

Unfortunately, I always get the error:

 

Property: DAQmx_SampTimingType Requested Value: DAQmx_Val_SampClk Possible Values: DAQmx_Val_OnDemand Task Name: _unnamedTask<0> Status Code: -200077

 

 

Does this mean that it's not possible to set the digital output timing for the NI6215?

It looks like maybe On-Demand timing is the only valid configuration, and that is maybe how I interpret the discussion of correlated DIO here. 

Or am I just going about this the wrong way??

 

Thanks for any advice you have.

 

-Rapp


Viewing all articles
Browse latest Browse all 2181

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>