On Wed, 27 Feb 2002 09:56:27 -0500 Tony Pan writes: > Hi, > > I want to use a pic to measure AC line voltage. First, my hardware > scales > down 200V to 5V and flips the negative duty cycle to positive so > that the > pic can read the signal. Then the pic reads the voltage every 0.1ms > with an > adc port. Now I have many almost 100 reads within a duty cycle. No > this is a > math question: How do I calculate the AC voltage from these reads? > This should be in the list archive, but here's a quick summary. As you get each reading, square it. Accumulate a sum of the squares. Divide the sum by the number of samples. Take the square root of the average of squares (just calculated). Harold FCC Rules Online at http://hallikainen.com/FccRules Lighting control for theatre and television at http://www.dovesystems.com ________________________________________________________________ GET INTERNET ACCESS FROM JUNO! Juno offers FREE or PREMIUM Internet access for less! Join Juno today! For your FREE software, visit: http://dl.www.juno.com/get/web/. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics