GetFrequency returning 0


I’m trying to read a magnetic pickup (flow meter) with an IDC5-FAST-A module. The flow meter has 2 test modes that output 10Hz and 250Hz. With both I can see in the software that the inputs are turning on and off, and I do have the input configured for frequency, but GetFrequency() always returns 0. When I view the module in debug, the textbox also shows the frequency as 0, but I can watch the state go on/off. Does anybody know what might be going on?


1 Like

What kind of brain is on that rack? E.g. SNAP-PAC-R2 or SNAP-PAC-EB1, something like that? I ask because Frequency is one of those features that requires a 1 (vs. 2) in that last number of the part…

1 Like

This may become relevant to me shortly, so for clarification:

I have a SNAP-PAC-R2,so I would need to get a IDC5-FAST if I wanted to measure a 12VDC ~1750kHz signal, and I’d have to make a frequency-finding subroutine like I found in a different forum post, correct?

I was using a SNAP-PAC-R2, that was the issue. I wound up calling technical support and Kathy was very helpful in figuring this out. Turns out I should have read the documentation before selecting a brain!

1 Like

Good to know, which way are you going with your solution? New brain or subroutine?

I’m going with a new brain; with a subroutine/dedicated chart I’d be worried about accuracy. The Nyquist frequency is the minimum frequency at which a signal can be sampled without errors, which is twice the highest expected frequency. Your scan time needs to be fast enough to detect the “on” part of the signal as well as the “off” part, so for a 250hz frequency you’d need a minimum scan time of 1 ms. I’m not sure the scan time exactly, but I’m thinking it would be very difficult to go above ~125hz without aliasing.

1 Like

You bring up a good point. I was already taking the maximum frequency the fast module could handle into account (my reasoning was it has a 25us (40kHz), so anything below 20kHz would be do-able).

But, I had forgotten that I’d have to have a strategy with that scan time, otherwise whatever I set the strategy scan time is gating the performance of the module, correct?

@mstjohn do I have that right?

Sorry for the delay, @JimmyTime, I’m not sure what you’re asking here. Could state it a different way?

No problem, I’ve learned a bit since asking the previous question, so I’ll try:

1.) A -FAST module has a rise/fall time of 25us (40kHz), so I would expect the fastest possible frequency it can reliably detect would be 20kHz, correct?

2.) Assuming I’d want to get something to work on my R2 brain, even if I did use a -FAST module to accurately detect the frequency, would I also need to make sure my frequency-counting chart was running fast enough to parse this?

3.) Is an R1 brain with the frequency function built-in a better solution? All my (5) opto’s on-site are R1 except for the single R2 I just happened to be starting with when I joined the team. We’re inclined to simply not use an R2 again if we need frequency measurement

On the plus side I think I’m making things more complicated than they need to be, but I’m not sure yet :slight_smile:

Short version:

  1. Yes
  2. It depends, but the R2 is the wrong tool for this problem.
  3. Yes.

I think you’ve got a handle on this now!

1 Like