07-06-2009 01:34 PM
Hi,
I am having an issue with PW Measurement, I need to read a Duty cycle in a percentage range from 0% to 100%. The problem I have is the signal has not crossed the mid reference level enough times to measure, or the histogram cannot be used because the amplitude is zero. This is obvious, yes, because there is no pulse, it is essentially all true or all false at these two extremes, but the pulse Measurement vi cannot handle this. Is there another way I could measure duty cycle, so that I can see if there is a low (0%) or High (100%), and everything in-between without errors? Even when I measure the PulseWidth in the peak method, rather than the histogram method, which gives me more time to stay at 0 or 100% before it gives an error, the measurement sees the signal as 50% duty cycle (once again obvious because it is neither hi nor low for any duration). So if I could even read 0% or 100 % without an error, how would I be able to block the two extremes from ever being read? My input is from the DAQ, so I cannot just "limit" my input signal at the source...
Any suggestions?
Thanks,
-CorbinSolved! Go to Solution.
07-07-2009 06:25 AM
How about an integration over one period?
Do you sample analog or digital values, or use a timer/counter?
How does the PWM look like (Stable frequency)?
07-08-2009 01:41 PM
Hi, Henrik, thanks for the response,
I wasn't really sure how to integrage over an amount of time in LabView, and I am reading a digital input- square wave (duty cycle). I found that I would need to omit extreme values such as 0% and 100%, so I could not find a way to do this with a sub VI. What I did find is my solution: I knew that +12V should be 100%, and 0V should be low, so I just used the "Amplitude and Level Measurements" sub VI to read the RMS value in, used a table I recorded of the correspondance (help via MatLab), and I no longer have any issues with errors due to histogram reference levels (not using histogram now...). My application can read everything from 0% to 100% and it returns my correct data after manipulation. Success!
There might have been a different way to go about solving the issue, but this works.
-Corbin
07-09-2009 04:00 AM
Corbin,
great to hear you have a solution. 🙂
If you take a look at the help you will see that the rms will do a integration 😉 hint: in the discrete world an integration is a sum
From help: rms.vi
Computes the root mean square (rms) of the input sequence X.
The rms(.vi) will give you a value proportional to the power
The mean(.vi) will give you a value proportional to the % PWM ( divide by V_max (12V) and multiply with 100 and you get a %PWM)
... this will only work exactly when you read exactly n periodes of your PWM, however the error gets smaller if you read longer...