LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure AC frequency on digital input of Cdaq 9411

I have been acquiring analog signals for awhile, but this is my first attempt at digital input so I may be barking up the wrong tree. I have an AC sine wave of varying amplitude and frequency. I need to measure the frequency, which will be between 10 and 200 Hz. I can acquire it on an analog card, but would prefer to use my 9411's digital input for a couple of reasons.

 

It seems to me there should be a way I can determine the frequency with the 9411, but here is what I've tried: Implicit counter task which, I think, outputs a sample point every time the voltage input crosses from low to high? I could do a software timed count of how often this happens, but I'm not sure exactly how to implement this, and it just seems like a bad idea. The other option is to run a 100kHz continuous sampling rate (using the 100kHz clock on the cDaq) and queue the data and process it. This seemed like a good idea, I queued a seconds worth of data at a time, but I cannot figure out how to count the number of level crossings. If this is the way to do it, and there is an easy way to count crossings, is there a way to slow the sample rate?

 

The final option is that there is no good way to do this with a digital input card, but I'm hoping that is not the case?

0 Kudos
Message 1 of 4
(3,694 Views)

Hi deskpilot,

 

Which chassis are you using?  I'll assume a 9172 since you mentioned you are using the 100 kHz timebase for your digital sample clock. 

 

The cDAQ counters are a part of the chassis (9172, 9174, 9178) and are on the backplane (the 9411 is one way to access the counters, it must be in slot 5 or 6 if you are using the 9172 chassis to do so).

 

 

If your sine wave meets the requirements to be detected as a TTL signal, then you could configure the counters to perform a frequency measurement (described on page 49 of the 9172 manual) on the signal directly.  Since the rise time is going to be long for a sine wave there is going to be an elevated risk of picking up duplicate edges; you might want to consider using digital filtering (described on page 69 of the 9172 manual).

 

 

Do you have an analog module such as the 9205 or 9206?

 

If your sine wave does not meet the requirements of a TTL signal, then you could instead use an analog module that supports analog triggering, configure the analog trigger, and measure the frequency of the Analog Comparison Event (my favorite description of what this signal looks like is in the M Series User Manual page 11-4).  If going this route you wouldn't need the digital module since the analog comparison event can be routed to the counter internally. 

 

Alternatively, you could compute the frequency in software (see this example).  This would involve sampling the signal (either analog or digital) and counting the number of zero crossings.  It sounds like you have started to work with this already using the 9411.

 

You can actually use one of the on-board counters to generate a clock signal to use for the Digital Input task.  Here is a link to an example that shows how this is done in software.

 

 

I hope that gives you some ideas of how to go about your application.  If you have any questions don't hesitate to post back!

 

 

Best Regards,

John Passiak
Message 2 of 4
(3,685 Views)

John,

 

Thank you for your detailed response. Just thumbing through it all quickly, looks like there is some very good info there. I gave up on the digital input after lunch, and finally got the software measured frequency turned into RPM by using my 9229 in my 9172 cDaq. But I designed this thing around using the 9411 for the RPM measurements, so I will be going through the links you provided to see if I can get back to my original design.

0 Kudos
Message 3 of 4
(3,678 Views)

Hi deskpilot,

 

Alas, the 9229 does not support analog triggering so the analog comparison event idea isn't going to work without other hardware.  Is the voltage of your sine wave such that it is TTL Compatible (just check the voltage levels rather than the rise and fall time)?

 

If so, try putting the 9411 into slot 5 or 6 of the 9172 and running one of the Measure Dig Frequency shipping examples:

 

2010-03-04_154009.png

 

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 4
(3,673 Views)