DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

Inverse Period Measurement

Solved!
Go to solution

Hello,

 

I am trying to perform what was described as an "inverse period measurement" (method one on this page: http://zone.ni.com/devzone/cda/tut/p/id/3619).  I am generating a 4000Hz signal, and a very low hz signal (both pulses) for comparison.  What I want to do is for one full pulse length of the low signal, count how many pulses occurred on the higher frequency.  I tried by using a relay with a control input to the low signal, but that seems to yield strange results (the number bounces all around).  I would expect the resulting counter to vary by +/- 1 with each repeated measurement.  Is there a better method for this measurement?

0 Kudos
Message 1 of 9
(7,425 Views)

Something like the attached? This is a V11 example.

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 9
(7,424 Views)

Something like that may work!  The biggest difference is that the low frequency signal in my example is a pulse, but maybe I could convert that to something else?  I am still picking that worksheet apart but I think I understand what it's doing.  What does the "measurement number" column mean on the List00, and how come it starts at 5000?

 

Here is what I see happening here (correct me if I'm wrong): The first relay cuts the high frequency in chunks equal to half a period of the low freq.  This then gets pushed through a counter which is also actuated with the low frequency signal on/off through the combi trigger.  What does the 2nd relay do?  I do notice that if you sample just before that 2nd relay you get numbers that go all over (similar to what I was running into).  Is that needed to cut up the data at the correct position?

 

Thanks,

Tom

0 Kudos
Message 3 of 9
(7,422 Views)

Hi,

 

It's going to work best if the timing period is a square wave type of signal.

I have to rethink it if it's the count between two pulses.

 

The first relay removes the fast signal when the timing signal (square wave) is low.

The second relay just outputs the final count, so you don't see the intermediate counting... it counts up, and then holds until the next high segment of the square wave.

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 4 of 9
(7,420 Views)

The only issue with the removal of data is it would take twice as long to get as much information.  The application I am working on relies on averaging over up to 2 minutes worth of data.  Previously it was simply counting two channels within one block (400ms), ratioing them, then going through a calculation.  But you get the +/- 1 count error on both counts, and they are fairly low numbers (maybe a 60/100 Hz ratio).  I figured that by comparing each of the 2 signals to a higher frequency signal like this, I could squeeze some more accuracy and loose the problem of +/- 1 except for on the high freq side. The other problem is I can only get the frequency up so high on the generator; higher frequency will mean less error.  4000Hz was fine, 5000 gave me a msg that it was too high.  I do have it tied to a daq card speed, which I think will be necessary.

 

I will experiment with this further and see if I can make it work with what I have. 

 

Tom

0 Kudos
Message 5 of 9
(7,418 Views)
Solution
Accepted by topic author TomEng

Here's counting between two pulses.

 

to make the reset work correctly, and still have the rising edge release the computed count, I have a one sample delay going to the counter control.

 

It seems to work with the numbers that I've given it.

 

This eliminates the first relay.

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
Message 6 of 9
(7,417 Views)

Thanks, this does seem to work!  Any thoughts on if it's possible to set it up with 2 generators with different time bases, and then perform this type of manipulation?  I run into time/block size errors and have had no luck with the adaptation module to fix it.  The only reason I wanted to try was to read "gen 0" through a daq, and then have gen 1 be a much higher freq.  I can't do that with them tied to the same time base.

0 Kudos
Message 7 of 9
(7,409 Views)

"read "gen 0" through a daq, and then have gen 1 be a much higher freq. "

 

What are the two sample rates?

 

The only way for this math to work is for both data channels to have the same sampling rate.

 

If they are both being read by the same DAQ, then the sample rates are the same.

 

If not, then you can UPSAMPLE the slower channel using the Signal Adapt, and connecting the fast channel to the first input, and the slow channel to the second input. Then select "Full Linear Interpolation" to interpolate the slower signal up the the sample rate of the first and faster input.

 

Can you post a worksheet example that gives you the measurement timing errors?

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 8 of 9
(7,406 Views)

I just used 2 signal generators in the example you sent, one tied to 10khz base (outputing low freq, 1-10hz), one at something like 50khz base (outputing ~ 20,000Hz).  I figured it was a good test for when a daq would be put in line (using 20khz base on daq).  When I tried the signal adapt, I had the slow signal on chan 0, fast one 1, I will reverse it and try the linear interpolation.

0 Kudos
Message 9 of 9
(7,404 Views)