Thanks Olin, It's true, the shape of the signal is known ( sinusoidal ) and I will use a peack detector. There is no modulation, but could be distorsions which will mess the whole measurement. On the other hand distorsions will increase the current into the load so measuring this one can gave me some informations about how clean is the signal. Vasile On Sat, 27 Apr 2002, Olin Lathrop wrote: > > I have to know your opinion regarding Vrms and frequency measurements > > for a continuous 1...100KHz signal ( 0... 2KVpp) > > > > There are a few principle I know for Vrms measurements: > > -- zero cross syncronizing with external interrupts on Rb3 or interrupts > > on change on rb4...rb7, delay with a half semi-period then sample and > > average will gave Vpeak to peak, then math to achieve Vrms > > -- V peak to peak measurement without mains syncronization using > > integrative methode and conversion to Vrms > > Both these methods only work if you know the shape of the waveform, > otherwise you have to do real RMS calculation on many samples. > > > For frequency measurement: > > -- tmr0 with external clock ( excluse here because > > I'm using tmr0 for button debounce and internal RTC ) > > -- compare/capture module which I haven't used yet... > > > > My problem is: both measurements must be performed "simultaneously", with > > the smallest possible delay. > > Real RMS voltage measurement at 100KHz is going to be pretty much impossible > with a bare PIC. You are going to need some external circuitry to help out. > Each full cycle is 10uS long, which gives you only 50 instructions on a 16 > family PIC or 100 on an 18 family. The A/D would be hard pressed to get > just one sample per cycle. If the waveform is known, then an external peak > detector would help a lot. What frequency AM modulation do you need to be > able to detect? If the waveform is not know, then it gets a lot more > complicated. > > The frequency side is much easier. The CCP module in capture mode is great > for measuring period. I've done this a bunch of times. Since you've got > such a large frequency range, you will probably want to use the capture > prescaler to capture every 4th or 16th pulse, at least at the higher > frequencies. > > > ***************************************************************** > Embed Inc, embedded system specialists in Littleton Massachusetts > (978) 742-9014, http://www.embedinc.com > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.