02-02-2009 05:45 PM
I'm receiving a PWM signal on a 6602 car counter. I want to measure the freq of this signal every 10 ms. This signal has variable frequency from low to high that can change every 10 ms. The examples in the LabView help (...Counter Measurement-> Digital Frequency) deal only with high freq, low freq and large range each situation with some pre-configurations. My measurement is blind except that I know my maximum frequency of 5000 Hz and the dyty cycle of the signal being always constant at 50%.
1) How to change LabView examples to fullfill my needs?
2) Can I detect and time stamp rising and falling edges and theb use the following formula?
T(falling)[i]- T(rising)[i-1]
---------------------------------- = 50%
T(rising)[i] - T(rising)[i-1]
How to take advantage of the above formula (if it is correct)?
Thank you for your help;
KizKas.
02-03-2009 02:32 PM
Hi KizKas,
If you take one of the examples like Meas Dig Frequency-Buffered-Cont-High Freq 2 Ctr.vi and you change it to use 1 counter low frequency. With this configuration using "implicit" timing you are using the 80MHz timebase to measure the frequency between the edges of one period of the signal you're trying to measure. This means that if you have a 5kHz signal (approximately) then you're giong to be getting a frequency measurement loaded into the buffer every ~.2ms. So, if you're looking to check for the frequency every 10ms you'll call the DAQmx read VI and you'll get about 50 frequency measurements, so you could do some processing to that data to see how the frequency changes over each 10ms span.
Chris W
02-03-2009 02:59 PM
02-04-2009 12:48 PM
I think that method is fine if it works for you, however, there is some uncertainly based on the fact that your duty cycle may not be exactly 50%. If you do a full period measurement, instead of a pulse width measurement, and invert the measurement (if it is units of seconds) then you will have basically the exact same thing that the frequency measurement does. I would suggest this, but if you are ok with some possible jitter in the duty cycle then your method seems fine.
Chris W
02-04-2009 03:47 PM
I forgot to mention, however, that the timing for this call to the DAQmx read VI that is being called inside your timed while loop is processor dependent. I know you have set the timed loop to execute with a period of 10ms but because this is not (or I'm assuming it's not) an RT system, you will not get a deterministic 10ms period for your loop. Check out this Knowledgebase article, it describes what I'm talking about.
Chris W