Hello,
I'm currently struggling to set up my cDAQ 9174 with a NI 9402 digital module for a sample clock buffered frequency measurement. I can get this to work fine with my NI 9215 installed and referencing the ai sample clock as shown below, this gives me no errors and properly displays the frequency I am trying to measure (frequency varying 16 - 83 Hz) at a sample rate of 32 Hz:
self.ai_task = nidaqmx.Task()
self.ci_task = nidaqmx.Task()
self.ai_task.timing.cfg_samp_clk_timing(
rate=32,
sample_mode=nidaqmx.constants.AcquisitionType.CONTINUOUS
)
ai_channel = self.ai_task.ai_channels.add_ai_voltage_chan(f"cDAQ1Mod1/ai0")
ci_channel = self.ci_task.ci_channels.add_ci_freq_chan(
counter='cDAQ1/ctr0',
min_val=1,
max_val=1000,
units=FrequencyUnits.HZ,
edge=Edge.RISING,
meas_method=CounterFrequencyMethod.LOW_FREQUENCY_1_COUNTER,
)
ci_channel.ci_freq_term = "/cDAQ1Mod2/PFI0"
ci_channel.ci_freq_enable_averaging = True
self.ci_task.timing.cfg_samp_clk_timing(
rate=32,
source='/cDAQ1/ai/SampleClock',
sample_mode=nidaqmx.constants.AcquisitionType.CONTINUOUS
)
However when I try to set up the NI 9402 to measure a sample clock buffered frequency measurement by itself, I have problems. I think I am missing something obvious here but I'm not seeing it:
self.clock_task = nidaqmx.Task()
self.ci_task = nidaqmx.Task()
self.clock_task.co_channels.add_co_pulse_chan_freq(
counter="/cDAQ1/ctr1",
freq=32,
)
self.clock_task.timing.cfg_implicit_timing(
sample_mode=AcquisitionType.CONTINUOUS
)
ci_channel = self.ci_task.ci_channels.add_ci_freq_chan(
counter='cDAQ1/ctr0',
min_val=1,
max_val=1000,
units=FrequencyUnits.HZ,
edge=Edge.RISING,
meas_method=CounterFrequencyMethod.LOW_FREQUENCY_1_COUNTER,
)
ci_channel.ci_freq_term = "/cDAQ1Mod2/PFI0"
ci_channel.ci_freq_enable_averaging = True
self.ci_task.timing.cfg_samp_clk_timing(
rate=32,
source='/cDAQ1/Ctr1InternalOutput',
sample_mode=nidaqmx.constants.AcquisitionType.CONTINUOUS
)
Here is the error I get, and no data is returned even when a TTL signal is supplied:
nidaqmx.errors.DaqError: Multiple Sample Clock pulses were detected within one period of the input signal. Use a Sample Clock rate that is slower than the input signal. If you are using an external Sample Clock, ensure that clock signal is within the jitter and voltage level specifications and without glitches.
Task Name: _unnamedTask<0>
Status Code: -201314
I can lower my sample rate and get data to appear, but the question is why does issue only occur with the 9402 module only? When I use the ai sample clock this issue doesn't occur. Is there a way I can mimic the behavior of the ai sample clock with another counter?