Hi Igor. I've done work for PICs using correlation with fixed frequencies. For PLL I was using hardware but it seems possible to do it in software as well for low frequencies. ( the same ideas ) In your case highest frequency is 500 Hz which is 2 mSec With 20 MHz PIC and (for say) 20% of PIC time used for PLL software you'll have 2000 clocks per sine period. Looks quite doable. With what speed the primary frequency can change ? ( Hz/sec) Do you need just to decode what is frequency/amplitude/phase or you really need to do PLL on that ? The more details the better WBR Dmitry. Igor Pokorny wrote: > > Hello Dmitry, > > you mentioned correlation. Do you know some methods how to do this with > PICs.? I would like to do PLL of the incoming signal very much (300 to 500 > Hz for about 100 to 300 miliseconds) but I am not able to find any algorithm > that would be able to filter a signal and/or to synchronize ADC by a proper > way. > > Igor > > -----Original Message----- > From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On > Behalf Of Dmitriy A. Kiryashov > Sent: Sunday, February 23, 2003 12:54 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [pic]:CCP Capture mode > > Greetings Scott. > > What if the first pulse you've captured is noise/wrong pulse? > You lock onto it and miss another one which is right. > > Why not filtering approach or correlation ? > > WBR Dmitry. > > Scott Dattalo wrote: > > OTOH, if there's a potential error source that can be identified, then > > there may be a potential fix to remove it. I can't see any *simple* fix. > > I'm not going to add extra hardware, and I really don't care to add extra > > inefficient software like the looping solution I proposed. However, > > another simple solution could be to inhibit the CCP module: > > > > MOVF CCP1CON,W ;Save the current CCP mode > > CLRF CCP1CON ;Disable the CCP module so that > > ;no new events are captured while > > ;we're reading the last captured event > > MOVFF CCPR1L,TC_CaptureLo ;Save the time for the last edge > > MOVFF CCPR1H,TC_CaptureHi ; > > MOVWF CCP1CON ;Restore the CCP mode > > BCF PIR1,CCP1IF ;Clear any spurious interrupt. > > > > Has anyone tried something like this? > > > > Scott > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > --- > avast! Antivirus: Inbound message clean. > Virus Database (VPS): 21.2.2003 > Tested on: 23.2.2003 21:06:40 > avast! is copyright (c) 2000-2003 ALWIL Software. > http://www.avast.com > > --- > avast! Antivirus: Outbound message clean. > Virus Database (VPS): 21.2.2003 > Tested on: 23.2.2003 22:52:15 > avast! is copyright (c) 2000-2003 ALWIL Software. > http://www.avast.com > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads