- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Use ADCINCVR at 8 bits and set the sampling rate to 32 samples in a cycle.
2. Using MAC find the square of the instantaneous signal
3. When multiplication is performed, the result is accumulated in the 32 bit accumulator
4. After 32 samples, read from the accumulator and extract the square root.
For this method to work, there should be exactly 32 readings every cycle. For this, use a Zero crossing detector and count the number of ADCINCVR results between each ZCD event. If the number of samples is greater than 32, increase the CalcTime parameter incrementally till the number of samples becomes 32. If the number of samples is less than 32, decrease the CalcTime parameter incrementally to bring the number of samples to 32.
I wouldn't call this method to be a simple one, but this works very well. The other way that I can think is to use an RMS converter and use PsoC to measure the output of the RMS converter. But this will be an expensive solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am currently working on the method you have mentioned on CY8CKIT-001. However, I am stuck on one problem: to make ADCINCVR sample 32 times on one cycle. Maximum I can do is 5 measurements.
Do have any recommendations on that?
I guess it should be done by clock setting and calctime but I could not figured out the best values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know for sure that there are the required formulas in the ADCINCVR datasheet. Have a look at pages 4 and 5.
You need 1024 DataClock cycles for the integrate-time and you may specify a calc-time to expand the total sampletime to your needs.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a couple of threads that might help -
http://www.eetimes.com/design/embedded/4006520/Improve-your-root-mean-calculations
http://www.cypress.com/?rID=52411
http://www.psocdeveloper.com/forums/viewtopic.php?f=3&t=2575
http://www.khalus.com.ua/psoc/pdf/appnotes/an2159.pdf
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a reference to this as being the fastest RMS calculation using shifts and adds.
April 1996 issue......
In 1996, an article in Dr Dobbs journal presented a square root algorithm that uses only shifts and adds--no multiplies and certainly no divides. It can be found here: www.ddj.com/documents/s=962/ddj9604l/ (requires registration).
I've been using this in every job and every project ever since--it's by far the fastest integer square root around, and I'm amazed that it's still so little known.
Try it out--you'll never look back!
- Paul Hills
Landis+Gyr Ltd
United Kingdom
Then this sub reference -
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't analyzed it well yet, but certainly going to do. Thank you for your recommendation. It looks quite interesting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For high CPU clock frequency and low data clock, I could increased the sampke rate. And now I can calculate RMS values very well. In that implementation I am using a sampling counter to get the mean of squares. However, the implementation graa introduced interests me in which the sample count over a period is constant, but in order to make it contant time interval of each sampling may vary. Now I am considering to make that implementation. However, I am stuck on assigning calctime parameter on code.
When I want to read PWM16_MSB & PWM16_LSB I get the result as zero. The datasheet states it can be read/set by device editor or PWM16 API. But I did not understand how to use PWM16 API on ADCINCVR. I assume I need to use the functions of a PWM16 with base addresses of ADC's PWM registers. But I do not know how to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unless someone else has a better understanding you might filke a tech case at
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But why "RMS-to-DC..."?
"Sin-to-DC..." would be correct, is not it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Sine-to-DC..." , sorry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure what you are asking, but "true" RMS generally specifies crest
factor to account for non-sinusoidal input signal RMS measurements.
RMS is used to compute power or signal energy.
So no, normally one thinks of RMS to DC conversion, which implies handling
of non-sinusoiudal (or distorted sine) signals as well for power measurements.
http://www.yokogawa.com/ymi/tutorial/tm-tutorial_wt_08.htm
http://cnx.org/content/m10055/latest/
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To measure non-sinusoidal voltage, RMS of the voltage is required to measure and calculate.
So "RMS measuring and calculating" is required, instead of "RMS-to-DC conversion", isn't it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are measuring the area under the periodic signal curve. Or instantaneous power
for a non-periodic signal.
Both statements are correct, in that you are doing calculations, trying to
get to the RMS value, which has a DC equivalent.
Semantics getting in the way.
Regards, Dana.