Got PLL working with the 1st order IIR loop filter.

This commit is contained in:
ha7ilm 2016-05-09 13:58:45 +02:00
parent a89d174ec5
commit 4ecc84eefd
2 changed files with 8 additions and 3 deletions

7
csdr.c
View file

@ -1987,8 +1987,11 @@ int main(int argc, char *argv[])
FEOF_CHECK;
FREAD_C;
//pll_cc(&pll, (complexf*)input_buffer, NULL, (complexf*)output_buffer, the_bufsize);
pll_cc(&pll, (complexf*)input_buffer, output_buffer, NULL, the_bufsize);
fwrite(output_buffer, sizeof(float), the_bufsize, stdout);
//fprintf(stderr, "| i");
//pll_cc(&pll, (complexf*)input_buffer, output_buffer, NULL, the_bufsize);
pll_cc(&pll, (complexf*)input_buffer, NULL, (complexf*)output_buffer, the_bufsize);
fwrite(output_buffer, sizeof(complexf), the_bufsize, stdout);
//fprintf(stderr, "| o");
TRY_YIELD;
}
}

View file

@ -1372,7 +1372,8 @@ void pll_cc(pll_t* p, complexf* input, float* output_dphase, complexf* output_vc
float input_phase = atan2(iof(input,i),qof(input,i));
float new_dphase = input_phase - p->output_phase; //arg(input[i]/abs(input[i]) * conj(current_output_vco[i]))
while(new_dphase>PI) new_dphase-=2*PI;
while(new_dphase<-PI) new_dphase+=2*PI;
if(p->pll_type == PLL_2ND_ORDER_IIR_LOOP_FILTER)
{
@ -1395,6 +1396,7 @@ void pll_cc(pll_t* p, complexf* input, float* output_dphase, complexf* output_vc
}
else return;
if(output_dphase) output_dphase[i] = p->dphase;
//if(output_dphase) output_dphase[i] = new_dphase/3.15;
}
}