Mohit (Lists) ha scritto: > 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. This is one of the methods I considered > 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). I DO have zero-cross detection since I'll also be driving a dimmering-triac, so definitely I'm going to make use of it. thank you! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist