LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

(Probably Super Easy) Digital Pulse Counting with NI 9402

I'm attempting to acquire the pulse frequency of my digital flowmeter. I have the FM signal routed to DIO0 on a NI 9402 module. When I use a 'digital input' virtual channel, I can see the flowmeter data coming through on a digital waveform graph. In an effort to simplify things, I'd like to take it a step further and use the 'counter input' virtual channel type to directly read pulse frequency -- however when I run this through DAQmx read, I'm not seeing any data (read.vi just times out). My digital signal experience is pretty limited, so I'm sure I'm missing something obvious. Does anyone know what edits I can make in order to read pulse frequency directly? 

 

In other words: Method 1 (DI) shows me successfully acquiring data, but requires post processing to obtain pulse frequency. Method 2 (CI) does NOT show successful acquisition of data. 

 

Note: I've sifted through various examples and forum posts, but haven't been able to solve my issue. I've attached my VI below. Thanks!

Download All
0 Kudos
Message 1 of 4
(2,291 Views)

Hi PFour,

 

As a place to start I would recommend using the example program Counter - Read Pulse Width and Frequency (Continuous), found at Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Counter Input. The main difference looks to be the DAQmx Timing VI setting, which ought to be implicit for counter input.

 

Regardless, the example program should give you a great place to start. 

 

Best of luck.

 

 

Kevin S.
Technical Support Engineering
National Instruments
0 Kudos
Message 2 of 4
(2,239 Views)

Hey Kevin.MN,

 

Thanks for the suggestion. I've looked through that example pretty thoroughly and unfortunately, even that won't generate data for me -- very weird. I made the timing.vi change to "implicit" but with no luck. When I probe the lines in my while loop, I can see that the loop is iterating, but there is absolutely no data being pumped out of the read.vi. 

 

Again, normally I would assume this is a hardware/ harnessing issue or something of that ilk, however when I use a DI channel instead of a CI channel everything works perfectly (but requires post processing in order to get my desired parameter, pulse frequency). It's all very strange -- seems as if the pulse frequency option for CI channels flat out doesn't work... hate to be that person who blames the hardware.

 

Also, the fact that even the 'Counter - Read Pulse Width and Frequency' example doesn't generate data when I know that data is flowing has me scratching my head.

0 Kudos
Message 3 of 4
(2,228 Views)

I'll bet you're getting an error.  You should let your terminate on either an error *OR* the stop button, and then also show that error somehow (front panel indicator, simple error dialog, etc.).   But it's hard to give advice on fixing an error unless we know what it is.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 4
(2,210 Views)