Re: [time-nuts] PLL Math Question

2014-03-14 Thread Magnus Danielson
Hi Bob, On 12/03/14 19:26, Bob Stewart wrote: Hi Magnus, Thanks very much for this response! It will be very easy to add the exponential averager to my code and do a comparison to the moving average. I have no experience with PI/PID. I'll have to look over the literature I have on them

Re: [time-nuts] PLL Math Question

2014-03-14 Thread Magnus Danielson
On 12/03/14 20:25, Hal Murray wrote: mag...@rubidium.dyndns.org said: Exponential averger takes much less memory. Consider this code: x_avg = x_avg + (x - x_avg) * a_avg; Where a_avg is the time-constant control parameter. Also note that if a_avg is a power of 2, you can do it all with

Re: [time-nuts] PLL Math Question

2014-03-14 Thread Magnus Danielson
Hi Bob, On 12/03/14 23:16, Bob Stewart wrote: x_avg = x_avg + (x - x_avg) * a_avg; Hi again Magnus, In fact, I just post-processed some data using that formula in perl. It looks great, and will indeed save me code and memory space. And, it can be a user variable, rather than hard-coded.

Re: [time-nuts] PLL Math Question

2014-03-14 Thread Magnus Danielson
On 13/03/14 07:35, Daniel Mendes wrote: Em 13/03/2014 01:35, Bob Stewart escreveu: Hi Daniel, re: FIR vs IIR I'm not a DSP professional, though I do have an old Smiths, and I've read some of it. So, could you give me some idea what the FIR vs IIR question means on a practical level for this

Re: [time-nuts] PLL Math Question

2014-03-14 Thread Magnus Danielson
On 13/03/14 13:57, Jim Lux wrote: On 3/12/14 10:06 PM, Chris Albertson wrote: On Wed, Mar 12, 2014 at 9:13 PM, Daniel Mendes dmend...@gmail.com wrote: This is a FIR x IIR question... moving average = FIR filter with all N coeficients equalling 1/N exponential average = using a simple rule to

Re: [time-nuts] PLL Math Question

2014-03-14 Thread Magnus Danielson
On 14/03/14 00:39, Bob Camp wrote: Hi Either grab a math pack (there are several for the PIC) or go to C. Timing at the Time Nuts level is about precision. We need *lots* of digits past the binary point :) Indeed. Throwing bits at the problems is relatively cheap today. Besides, you don't

Re: [time-nuts] PLL Math Question

2014-03-14 Thread Dan Kemppainen
Bob, Just been reading along, enjoying the conversation... I've written a lot of hand coded assembly. Some of it very similar to what you are doing here now. (Although, a different processor family) I really didn't want to switch to C for anything, since code generated is 'bloated'. That being

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Daniel Mendes
Em 13/03/2014 01:35, Bob Stewart escreveu: Hi Daniel, re: FIR vs IIR I'm not a DSP professional, though I do have an old Smiths, and I've read some of it. So, could you give me some idea what the FIR vs IIR question means on a practical level for this application? I can see that the MA is

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Hal Murray
albertson.ch...@gmail.com said: We have to define best. I'd define it as the error integrated over time is minimum. I think PiD gets you that and it is also easy to program and uses very little memory. Just three values (1) the error, (2) the total of all errors you've seen (in a perfect

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Jim Lux
On 3/12/14 10:06 PM, Chris Albertson wrote: On Wed, Mar 12, 2014 at 9:13 PM, Daniel Mendes dmend...@gmail.com wrote: This is a FIR x IIR question... moving average = FIR filter with all N coeficients equalling 1/N exponential average = using a simple rule to make an IIR filter Isn't his

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Bob Stewart
else's control code on this PIC if I can get it to work properly my way. Bob From: Jim Lux jim...@earthlink.net To: time-nuts@febo.com Sent: Thursday, March 13, 2014 7:57 AM Subject: Re: [time-nuts] PLL Math Question On 3/12/14 10:06 PM, Chris Albertson

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Dennis Ferguson
On 12 Mar, 2014, at 23:08 , Hal Murray hmur...@megapathdsl.net wrote: b...@evoria.net said: In the moving averages I'm doing, I'm saving the last bit to be shifted out and if it's a 1 (i.e. 0.5) I increase the result by 1. That's just rounding up at an important place. It's probably a

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Bob Stewart
From: Dennis Ferguson dennis.c.fergu...@gmail.com To: Discussion of precise time and frequency measurement time-nuts@febo.com Cc: Hal Murray hmur...@megapathdsl.net Sent: Thursday, March 13, 2014 1:58 PM Subject: Re: [time-nuts] PLL Math Question Note that you can't do fixed-point computations

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Chris Albertson
...@gmail.com To: Discussion of precise time and frequency measurement time-nuts@febo.com Cc: Hal Murray hmur...@megapathdsl.net Sent: Thursday, March 13, 2014 1:58 PM Subject: Re: [time-nuts] PLL Math Question Note that you can't do fixed-point computations exactly the same way you would

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Bob Stewart
PM Subject: Re: [time-nuts] PLL Math Question You don't really shift so much as just change the way you think about it.   The way to think about it is not that you have 16th but that you have the binary point force places over.   It works just like a decimal point.  If you multiply two

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Bob Camp
From: Dennis Ferguson dennis.c.fergu...@gmail.com To: Discussion of precise time and frequency measurement time-nuts@febo.com Cc: Hal Murray hmur...@megapathdsl.net Sent: Thursday, March 13, 2014 1:58 PM Subject: Re: [time-nuts] PLL Math Question Note that you can't do

Re: [time-nuts] PLL Math Question

2014-03-13 Thread Hal Murray
li...@rtty.us said: Timing at the Time Nuts level is about precision. What's the term for a time-nut that's trying to be not-very-nutty? -- b...@evoria.net said: includes a 10-bit PWM dithered to 14 bits When you get it all working, that's going to be one of the weak links, at

[time-nuts] PLL Math Question

2014-03-12 Thread Bob Stewart
Now that I've got the TIC going, I'm working on the PLL math for my GPSDO.  My question is about moving averages.  I've put in a moving average for the TIC.  From that, I've calculated the slope, and have put a moving average on the slope to settle it down.  I think this boils down to a moving

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Magnus Danielson
Bob, On 12/03/14 18:24, Bob Stewart wrote: Now that I've got the TIC going, I'm working on the PLL math for my GPSDO. My question is about moving averages. I've put in a moving average for the TIC. From that, I've calculated the slope, and have put a moving average on the slope to settle it

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Bob Stewart
Sent: Wednesday, March 12, 2014 12:51 PM Subject: Re: [time-nuts] PLL Math Question Bob, On 12/03/14 18:24, Bob Stewart wrote: Now that I've got the TIC going, I'm working on the PLL math for my GPSDO.  My question is about moving averages.  I've put in a moving average for the TIC.  From

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Hal Murray
mag...@rubidium.dyndns.org said: Exponential averger takes much less memory. Consider this code: x_avg = x_avg + (x - x_avg) * a_avg; Where a_avg is the time-constant control parameter. Also note that if a_avg is a power of 2, you can do it all with shifts rather than multiplies. Note that

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Bob Stewart
@febo.com Cc: hmur...@megapathdsl.net Sent: Wednesday, March 12, 2014 2:25 PM Subject: Re: [time-nuts] PLL Math Question mag...@rubidium.dyndns.org said: Exponential averger takes much less memory. Consider this code: x_avg = x_avg + (x - x_avg) * a_avg; Where a_avg is the time-constant control

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Bob Stewart
From: Magnus Danielson mag...@rubidium.dyndns.org To: time-nuts@febo.com Sent: Wednesday, March 12, 2014 12:51 PM Subject: Re: [time-nuts] PLL Math Question Bob, snip Exponential averger takes much less memory. Consider this code: x_avg = x_avg + (x - x_avg) * a_avg

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Hal Murray
b...@evoria.net said: In the moving averages I'm doing, I'm saving the last bit to be shifted out and if it's a 1 (i.e. 0.5) I increase the result by 1. That's just rounding up at an important place. It's probably a good idea, but doesn't cover the area I was trying to point out. Let me

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Bob Stewart
and frequency measurement time-nuts@febo.com Cc: hmur...@megapathdsl.net Sent: Wednesday, March 12, 2014 10:08 PM Subject: Re: [time-nuts] PLL Math Question b...@evoria.net said: In the moving averages I'm doing, I'm saving the last bit to be shifted out and if it's a 1 (i.e. 0.5) I increase

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Daniel Mendes
, March 12, 2014 10:08 PM Subject: Re: [time-nuts] PLL Math Question b...@evoria.net said: In the moving averages I'm doing, I'm saving the last bit to be shifted out and if it's a 1 (i.e. 0.5) I increase the result by 1. That's just rounding up at an important place. It's probably a good idea

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Bob Stewart
dmend...@gmail.com To: Discussion of precise time and frequency measurement time-nuts@febo.com Sent: Wednesday, March 12, 2014 11:13 PM Subject: Re: [time-nuts] PLL Math Question This is a FIR x IIR question... moving average = FIR filter with all N coeficients equalling 1/N exponential average

Re: [time-nuts] PLL Math Question

2014-03-12 Thread Chris Albertson
On Wed, Mar 12, 2014 at 9:13 PM, Daniel Mendes dmend...@gmail.com wrote: This is a FIR x IIR question... moving average = FIR filter with all N coeficients equalling 1/N exponential average = using a simple rule to make an IIR filter Isn't his moving average just a convolution of the data