02-23-2007 01:49 PM
Hi Beavercreek,
Duty cycle measurement uses implicit timing and therefore it is difficult to associate a time with the measurement. Implicit timing simply means that the measurement begins when an edge is seen, not at a defined interval. I like to use the following analogy:
There are two people in a room. One is turning on and off the light. The other is using a stopwatch to time how long the light is on or off. If I ask the stopwatch person, at set intervals, to tell me the time of the signal he may be in the middle of a measurement and will have no useful information to report. On the other hand, I can ask the stopwatch person to yell out the elapsed time whenever he sees the light turn on or off. This is implicit timing.
One solution I would like to suggest (which may be simpler for you than trying to sum up semi-period measurements to get a corresponding time) is to read your PWM signal on one of your analog input channels. You can then see your PWM signal in relation to your data on a graph if you choose. There is a function, Pulse Measurements.vi in LabVIEW, which will measure the high and low time of your signal as well as duty cycle.
If the signal must be measured with the counter you could clock your analog tasks off of the PWM signal. However, this would require the PWM signal to be running prior to your analog measurement. To do this you would wire the PWM signal to an available PFI line and specify the line as your clock source in the DAQmx Timing VI that you use for your analog task. This would work well if your PWM signal had a constant frequency (i.e. 2500Hz) but varying duty cycle.
Hope this helps,
Jennifer O.
Applications Engineer
National Instruments
02-26-2007 11:11 AM
Hello Jennifer, Thank you for the response!
>One solution I would like to suggest (which may be simpler for you than trying to sum up semi-period measurements to get a corresponding time) is to read your PWM signal on one of your analog input channels. You can then see your PWM signal in relation to your data on a graph if you choose. There is a function, Pulse Measurements.vi in LabVIEW, which will measure the high and low time of your signal as well as duty cycle.
I've done some quick calculations on this (I like to know what I'm giving up) and here's what I came up with. Since my PWM is 30-4000Hz and since I also need to acquire two analog inputs simultaneously (signal input to UUT and PWM output), the maximum sample rate I could get with my 6031E card is 50000S/s. Which means that I have 13 samples available during each period of a 4000 Hz PWM. 13 Samples equates to 7.7 % duty cycle measurement resolution. Do you agree? Using the counter input (20MHz clock) I would have 5000 samples available during each period of a 4000Hz PWM and therefore 0.02 % duty cycle measurement resolution. Almost 400 times more resolution. That just seems too valuable to give up (at least one thing i'm ignoring in these calculations is quality of the 20Mhz oscillator)
>If the signal must be measured with the counter you could clock your analog tasks off of the PWM signal. However, this would require the PWM signal to be running prior to your analog measurement. To do this you would wire the PWM signal to an available PFI line and specify the line as your clock source in the DAQmx Timing VI that you use for your analog task. This would work well if your PWM signal had a constant frequency (i.e. 2500Hz) but varying duty cycle.
Great! The PWM is running prior to acquisition! I think this is the method I will be persuing. Since I need to sample my analog at at least 2500 Hz, this method will work well down to that PWM frequency. For PWM frequencies from 30 up to 2500 I'm in a no-mans-land with no decent method. It's really too bad the pulse width measurement vi cant be taught to report stale values until a new measurement becomes available (for example when my PWM is at 30Hz), after all, if a new pulse hasn't been received, the duty cycle can't have changed!(except for in the mind of the controller) Now that I've said it, I could probably achieve stale data reporting myself with the call external code features of labview, but I'm afraid my learning curve would not meet the timing expectations of my management.
02-28-2007 12:05 AM