1. Can you do a 'peak-detector' in software? Continuously read the ADC, keep comparing all the readings and the maximum value would be what you are after. 2. If you know the frequency (F), then detect zero-crossing and begin to take a set of ADC readings a few tens of milliseconds before (zero-cross + 1/4F seconds) and carry on till a few seconds after (zero-cross + 1/4F seconds). Compare these readings and get the maximum value. This would be less heavy on the processing resources than 1 above as you will be reading the ADCs lesser times per cycle, but will need hardware for zero-detection (an extra PIC pin). HTH, Mohit Mahajan. www.BioZen.co.in Dario Greggio wrote: > I am to use a 24FJxxGA106 to (along other things) measure 220V mains > voltage with some coarse accuracy, say 1-2% > > I have a small 220->6V transformer, whose inputs goes via a partitor > (still have to decide, but let's assume it 4K7 - 2K2) to AN2 of the PIC. > So, more or less 2Vrms or 3Vpp circa when mains is nominal 220V. > > I'm planning on sampling/reading the input voltage some ... 100? times / > second, and perform a ... FFT or something simpler upon it. > > Can you suggest the simplest way to achieve that result? > > TIA > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist