Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

Count rising edges of counter with Python

$
0
0

Hey there,

 

I am trying to count the rising edges of an internal timer of our USB-6366 (X-Series) device with Python via nidaqmx.

I found the following example to do that in the git repository ni/nidaqmx-python:

https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_examples/ci_count_edges.py

 

This example doesn't work for me. I am always getting 0 as the count.

Therefore I tried these lines of code:

 

with nidaqmx.Task() as task:

     task.ci_channels.add_ci_count_edges_chan("Dev1/ctr0")
     task.timimng.cfg_samp_clk_timing(10000000, "10MHzRefClock")

     task.start()

     print("data:", task.read(1000))

 

I really don't have a clue if that's the right approach, but it makes (at least a little bit) sense to me.

If there are any better solutions, I will appreciate some hints!

 

Please keep in mind, that my program should be as simple as it sounds: just counting.

 

 

Thanks in advance. 🙂


Viewing all articles
Browse latest Browse all 1271

Trending Articles



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