08-01-2017 04:47 PM
I am using a USB-6009 multifunction DAQ with Windows 10, nidaqmx-python 0.5.5 and Python 3.6 as a digital counter on the PFI0 port. The counter tests good in NI MAX 17. Also, if I read multiple samples, the counter does increment as expected when presented with a 1 kHz square wave.
However, I find that the counter state is reset before every read operation. In other words, if I read 1 sample at a time, I will get the value "0" or "1" as an output. If I read, for example, 1000 samples at once, each sample (more or less, depending on sampling rate) is incrementing as expected.
I am using the example code in ci_count_edges.py, which uses i_channels.add_ci_count_edges_chan().
The underlying NI DAQ MX function is DAQmxReadCounterU32Ex(), which isn't supposed to do this. Therefore, the cause is a bit of a mystery to me.
Any ideas on why the counter is not maintaining state between calls to DAQmxReadCounterU32Ex()?
08-02-2017 06:46 PM
How are you setting up your DAQ task in python? Can you include any modifications you have made to this code? What are all of the parameters you are using with the DAQmxReadCounterU32Ex()?