From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Use 2 frequency inputs with same counter?

Hello!

 

How can I use 2 different PFI on the same counter with tasks? I have PFI0 and PFI1 in use.

 

Many thanks!

0 Kudos
Message 1 of 11
(2,779 Views)

Not really sure what you're asking.  Can you rephrase your question and describe your situation in more detail?

 

What's your DAQ device?  What are your signals?  What kind of counter task(s) do you plan to use?

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 11
(2,739 Views)

Hello Jobar1933,

 

would you like to count the edges of PFI0, or that of PFI1? Maybe both?

Or do you plan to have for example a source and an enable signal on the two lines?

What hardware do you use?

Please give us more details...

 

Best Regards,

NI TSE

0 Kudos
Message 3 of 11
(2,733 Views)

Hi all,

 

Wow, sorry I just realized I never replied to you guys. Well, basically I have a cDAQ and a NI9212 module to which I have connected 2 flow meters. Their output is a frequency. When I look at each frequency separately in NImax it works fine, I can see them. But when I try to combine them in the same VI, they don't work together.

 

How can I overcome this?

 

Many thanks in advance !

0 Kudos
Message 4 of 11
(2,552 Views)

Isn't the cDAQ 9212 a temperature measurement module?

 

If you have another digital module that can feed a TTL frequency signal into the chassis' internal counters, then the answer would be to make distinct tasks using distinct internal counters to be able to measure both frequncies at the same time.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 5 of 11
(2,538 Views)

Hi!

 

You are correct, my bad. The module I have for the flow meters is 9421.

 

To better formulate the problem, I have 2 frequencies I want to measure in my VI, but using the NI9421 I can only measure 1 at a time. I've tried to set CTR0 to PFI0 and CTR1 to PFI1 but it doesn't solve the problem.

 

Is my setup enough to measure 2 frequency inputs at the same time?

0 Kudos
Message 6 of 11
(2,524 Views)

Can you post your code?  And please use "save for previous version" back to LV 2016.

 

It's very likely your chassis and module are capable of 2 simultaneous frequency measurement tasks.  The code you've used to try it out is more likely where the problem is.

 

Caveat: I have limited familiarity with the cDAQ platform.  Most DAQ capabilities are similar to the desktop boards I know better, but once in a while there's an added feature or some extra limitations.  Your app isn't the kind of thing where I'd expect such a difference, but I can't say 100% for sure.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 7 of 11
(2,510 Views)

Thank you for your interest!

 

I have attached the code to this message. I hope it helps. "Freq0" and "Freq1" have been defined in niMAX.

0 Kudos
Message 8 of 11
(2,497 Views)

You have a lot of things in the same loop together, creating a timing dependency among all the tasks.  You also aren't catching or reacting to any errors in your tasks, leaving you with no clues to the problem.

 

Odds are that the Ctr frequencies you're measuring are fast enough and your Ctr task buffers are small enough that you get a buffer overflow error that you aren't seeing.  Probably the loop can't iterate fast enough to give you enough opportunities to read your Ctr data.

 

Things that might be slowing your loop:  I'm a bit suspicious whether your temperature task can *actually* run at 50 Hz.  Also suspicious of the Express VI for file writing inside the loop.  File access can be slow if the file is re-opened every iteration, which the Express VI might do.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 9 of 11
(2,486 Views)

Thank you for your reply. I have also noticed that when the flow-rate sensor does not output a frequency because there is no flow in it, the VI doesn't like it. But as soon as flow moves again through the sensor it works.

0 Kudos
Message 10 of 11
(2,460 Views)