Path: csiph.com!goblin2!goblin.stu.neva.ru!aioe.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Phil Hobbs Newsgroups: sci.electronics.design Subject: Re: Microcontroller phase locked loop, ping Tim Wescott et. al. Date: Thu, 06 Aug 2015 16:34:52 -0400 Organization: A noiseless patient Spider Lines: 83 Message-ID: <55C3C4EC.9020504@electrooptical.net> References: <55c39580$0$7076$4c5ecfc7@frugalusenet.com> <55C39FEF.5010708@electrooptical.net> <55c3a544$0$25479$4c5ecfc7@frugalusenet.com> <55C3A685.6060401@electrooptical.net> <55c3b0fc$0$1754$4c5ecfc7@frugalusenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: mx02.eternal-september.org; posting-host="e1355fd8c2133ed0e70d1dbfee3de196"; logging-data="13201"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18g5oNVLu/u5qyB467RCjAG" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <55c3b0fc$0$1754$4c5ecfc7@frugalusenet.com> Cancel-Lock: sha1:wjF0a4iJg6m/bRfA5xKl43yOluo= Xref: csiph.com sci.electronics.design:371902 On 8/6/2015 3:09 PM, bitrex wrote: > On 8/6/2015 2:25 PM, Phil Hobbs wrote: >> On 8/6/2015 2:19 PM, bitrex wrote: >>> On 8/6/2015 1:57 PM, Phil Hobbs wrote: >>>> On 8/6/2015 1:12 PM, bitrex wrote: >>>>> Has anyone successfully implemented a phase locked loop on a >>>>> microcontroller? >>>>> >>>>> The frequency of interest would be somewhere in the 200kHz range, and >>>>> the objective of the PLL would be FM demodulation. So I'd have an >>>>> input >>>>> for the FM modulated frequency, and an external VCO in that range that >>>>> the uC would hopefully control via filtered PWM. Other than that, >>>>> this >>>>> is mostly hypothetical for now. >>>>> >>>>> Does this seem possible? I have the following reference: >>>>> >>>>> http://liquidsdr.org/blog/pll-howto/ >>>>> >>>>> I'd be hoping to use something like an ATTiny. All code would be >>>>> adjusted to use fixed-point math, I'd imagine. >>>> >>>> For a given resolution, you might as well just use a counter input. >>>> >>>> It's not going to be a very good demodulator...what modulation >>>> frequency >>>> and modulation index are you looking to accommodate? >>>> >>>> Cheers >>>> >>>> Phil Hobbs >>>> >>> >>> Ah, wait a second, I got confused. I don't actually need this PLL to do >>> FM demodulation, haha. Rather embarrassing. What I have is maybe an >>> external sine VCO whose "base frequency" I would like to lock to a >>> reference. So we have a varactor diode or something for CV input on the >>> oscillator, and over long time scales the PLL keeps the VCO synced to >>> some kind of reference (generated by the uC?) or something like this. >>> >>> Maybe there's a better way to do this. >> >> How about a 4046? Guaranteed to lock up anywhere in the VCO's range. >> >> Do you want to lock it at 1:1 or some other ratio? >> >> Cheers >> >> Phil Hobbs >> > > I'm not sure that it would work in the application I'm thinking of. What > I want is basically a "tuning" feature where I can have > apply a CV to a bunch of RF VCOs that will sync them up to a crystal > controlled reference, then allow the VCOs frequency to vary about that > reference frequency. When you say "allow", do you mean "cause"? If you're just trying to temperature compensate the free-running frequency, that's a frequency-locked loop (FLL) rather than a phase-locked loop, and is a much easier problem. Using a uP to implement an FLL is quite reasonable. For a current project, I'm doing something a little bit similar: linearizing VCOs using a Labjack plus a cubic spline fit. (The spline is done inversely, i.e. the frequency is the independent variable and the spline gives you the corresponding DAC code.) Cheers Phil Hobbs -- Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net