Yeah, I need the RMS i.e. 220V :) The Filtering idea was provided by Dwayne as part of his code and I took it kind of good, since "smoothing" could've helped in making the samples more "smooth"... But indeed the idea of grabbing the peak out of 20mS makes sense - I started with a FFT, then I realized (and was suggested) it was too much. Then I wanted to take a sample here & there, and this was not going to work. Then I made up my mind with the "20mS window" and now this gets better. I do have memory - a 24F PIC, so I might try what you suggest. I will recheck your calculations about degrees and errors, but makes sense. I also have to say that, after the IIR, overall sum of 20 samples does no longer yeld 0... ! (this was part of my astonishment, but I have proably skipped some steps) thank you! -- Ciao, Dario -- Cyberdyne -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist