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: 

Simple Period Measurement

Solved!
Go to solution

Hopefully this will be an easy one for somebody, but working on site under pressure and I can't see what is wrong Smiley Frustrated

 

I have a PCI-6351 card and I am testing it with NI-MAX, I setup a simple task to measure the period of the TTL level square wave running at 500Hz.  I don't put much faith in the function generator for the frequency value but the signal is clean.  Using NI-MAX I run the task and would expect to get constant values around 0.002 seconds, but I get all sorts of values.  The image below shows the results and settings.  

 

image.png

 

There shouldn't be anything more to it should there?

Thanks much,

Mande.

0 Kudos
Message 1 of 5
(3,238 Views)

I suppose this has to do with the debounce filter, it must be defaulted to be 90ns in NI-MAX.

I have found the code to set it within LabWindows, is it not possible to set it in NI-MAX so I can see what it reads?

0 Kudos
Message 2 of 5
(3,225 Views)

I don't know of a way to set up digital filters on specific terminals via MAX, but I'm admittedly a couple versions behind.

 

Aside from that, your measured values have a very suspiciously repetitious quality about them.  I've gotta wonder if the signal is still clean as it enters your board.

 

Given what appears to be a 90 nanosec quanta, you have an extremely modal distribution.

You've got 3 distinct repeating values:  987 (five times), 0 (three times), and 1012 (five times) usec and only 1 instance of the expected 2000 usec.

 

My suspicion is you have a not-quite square wave, 1012.5 usec in low state 987.5 in high.  You also have some kind of glitch or ringing on your falling edges so that they just about always produce an extra phantom rising edge.  And some of them produce 2 such phantom edges separated by 90 nanosec.

 

It's conceivable that the 90 nanosec intervals are a result of prior config you've done to set up a 90 nanosec input filter on that pin.  While I don't think you can *set* it in MAX, it's possible that you've configured it in a way where it remains persistent as you use MAX.

 

 

-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 3 of 5
(3,201 Views)

Thanks for the feedback!

 

We just received this card, and have a function generator tied directly to the counter input, it looks clean when looking at it with a scope, but I was also assuming that the counter card sees something.

 

I have been trying to programmatically change the digital filter but I keep getting an error that the device or task does not support that option, so I'm not sure how it ever got set to 90 ns.  I figured the readings would clean up if I could get the filter set to 5.12 us as the documentation says this is another available filter.  I just can't get the function to work 😞

0 Kudos
Message 4 of 5
(3,193 Views)
Solution
Accepted by topic author Mande

This might as well be considered closed.

 

It appears that without a digital filter, any bounce in the signal will give you a reading equal to the smallest filter than can be set.  In this case, it is possible to set a 90ns filter, and without it I get regular 90ns readings.  Once I was able to set the digital filter, this problem went away.

 

When setting the filters using LabWindows, you must be aware that there are different attribute constants for different types of measurements.  

DAQmx_CI_Period_DigFltr_MinPulseWidth is the attribute to set when doing a period measurement.

DAQmx_CI_PulseWidth_DigFltr_MinPulseWidth is the attribute to set when doing a pulse width measurement.

 

It seems a bit much to have different constants for setting the digital filter, but at least I finally figured it out.

Thanks.

Message 5 of 5
(3,171 Views)