Add frequency resolution computing

This commit is contained in:
F5OEO 2018-03-20 13:42:43 +00:00
parent 2925373382
commit 754c341387
2 changed files with 18 additions and 1 deletions

View file

@ -194,7 +194,7 @@ int clkgpio::ComputeBestLO(uint64_t Frequency,int Bandwidth)
best_divider=0;
for( divider=1;divider<4096;divider++)
{
if( Frequency*divider < 600e6 ) continue; // widest accepted frequency range
if( Frequency*divider < 300e6 ) continue; // widest accepted frequency range
if( Frequency*divider > 1500e6 ) break;
max_int_multiplier=((int)((double)(Frequency+Bandwidth)*divider*xtal_freq_recip));
@ -242,6 +242,22 @@ int clkgpio::ComputeBestLO(uint64_t Frequency,int Bandwidth)
}
}
double clkgpio::GetFrequencyResolution()
{
double res=0;
if(ModulateFromMasterPLL)
{
res=XOSC_FREQUENCY/(double)(1<<20)/PllFixDivider;
}
else
{
double Freqresult=(double)Pllfrequency/(double)(CentralFrequency);
uint32_t FreqDivider=(uint32_t)Freqresult;
res=(Pllfrequency/(double)(FreqDivider+1)-Pllfrequency/(double)(FreqDivider))/4096.0;
}
return res;
}
int clkgpio::SetCenterFrequency(uint64_t Frequency,int Bandwidth)
{
CentralFrequency=Frequency;

View file

@ -161,6 +161,7 @@ class clkgpio:public gpio
void SetPhase(bool inversed);
void SetAdvancedPllMode(bool Advanced);
int SetCenterFrequency(uint64_t Frequency,int Bandwidth);
double GetFrequencyResolution();
int ComputeBestLO(uint64_t Frequency,int Bandwidth);
int SetMasterMultFrac(uint32_t Mult,uint32_t Frac);
uint32_t GetMasterFrac(double Frequency);