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

Flowmeter output acquisition through NI 6008 with python code

$
0
0

Dear,

 

I'm struggling to make a simple python script work.

I 'm using a flowmeter sensor (FTB601 from Omega) I would like to acquire the count with the NI 6008 (PFI0 port) to measure the frequency and plot the flowrate. Seen the signal (square wave) ranges from 60 to 1200 Hz, I must use the PFI0 port. If I'm not wrong, the DI ports may fail over 500 Hz.

 

To do it, I'm coding with Python (3.11.4) with the nidaqmx library.

Here is the code I used:

import nidaqmx
with nidaqmx.Task() as task:

try:

task.ci_channels.add_ci_count_edges_chan("Dev1/ctr0")
count = task.read()
print(count)

except KeyboardInterrupt:

print("Count stopped.")

 

For a reason I ignore, It doesn't work as expected and I get the following error message:

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_CI_CountEdges_ActiveEdge
Requested Value: DAQmx_Val_Rising
Possible Values: DAQmx_Val_Falling
Channel Name: Dev1/ctr0

Task Name: _unnamedTask<18>

Status Code: -200077

I didn't find a solution on the tens of forum I searched in.

Could someone help me with this issue ?

 

I tried adding the following arguments to the function

task.ci_channels.add_ci_count_edges_chan('Dev1/ctr0', initial_count=0, edge=Edge.RISING, count_direction=CountDirection.COUNT_UP)

but then, it's saying that "Edge is not defined", or "CountDirection" is not defined.

 

Bet regards,

 

TSF

 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



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