06-20-2019 04:21 AM - edited 06-20-2019 04:28 AM
Hello!
How can I use 2 different PFI on the same counter with tasks? I have PFI0 and PFI1 in use.
Many thanks!
06-20-2019 02:29 PM
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
06-21-2019 01:50 AM
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
09-25-2019 08:17 AM
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 !
09-25-2019 09:49 AM
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
09-26-2019 01:48 AM - edited 09-26-2019 02:33 AM
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?
09-26-2019 08:44 AM
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
09-27-2019 01:37 AM
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.
09-27-2019 09:00 AM
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
09-30-2019 06:45 AM
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.