Working bpsk_costas_loop_cc
This commit is contained in:
parent
efbe28cbfd
commit
36eb0c3481
3 changed files with 6 additions and 3 deletions
1
csdr.c
1
csdr.c
|
@ -2778,6 +2778,7 @@ int main(int argc, char *argv[])
|
||||||
sscanf(argv[4],"%f",&gain);
|
sscanf(argv[4],"%f",&gain);
|
||||||
|
|
||||||
int decision_directed = !!(argc>5 && (!strcmp(argv[5], "--dd") || !strcmp(argv[5], "--decision_directed")));
|
int decision_directed = !!(argc>5 && (!strcmp(argv[5], "--dd") || !strcmp(argv[5], "--decision_directed")));
|
||||||
|
if(decision_directed) fprintf(stderr, "csdr bpsk_costas_loop_cc: decision directed mode\n");
|
||||||
|
|
||||||
bpsk_costas_loop_state_t state;
|
bpsk_costas_loop_state_t state;
|
||||||
init_bpsk_costas_loop_cc(&state, decision_directed, damping_factor, loop_bandwidth, gain);
|
init_bpsk_costas_loop_cc(&state, decision_directed, damping_factor, loop_bandwidth, gain);
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>value</key>
|
<key>value</key>
|
||||||
<value>0</value>
|
<value>10</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>_enabled</key>
|
<key>_enabled</key>
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>num_steps</key>
|
<key>num_steps</key>
|
||||||
<value>100</value>
|
<value>1000</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>style</key>
|
<key>style</key>
|
||||||
|
@ -693,7 +693,7 @@
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>commandline</key>
|
<key>commandline</key>
|
||||||
<value>csdr bpsk_costas_loop_cc $(csdr =2*pi/100) 0.707 1 </value>
|
<value>csdr bpsk_costas_loop_cc $(csdr =2*pi/100) 0.707 300 --dd 2>/tmp/cout</value>
|
||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<key>comment</key>
|
<key>comment</key>
|
||||||
|
|
|
@ -2100,10 +2100,12 @@ void bpsk_costas_loop_cc(complexf* input, complexf* output, int input_size, bpsk
|
||||||
else error = iof(output,i)*qof(output,i);
|
else error = iof(output,i)*qof(output,i);
|
||||||
s->dphase = error * s->alpha + s->iir_temp;
|
s->dphase = error * s->alpha + s->iir_temp;
|
||||||
s->iir_temp += error * s->beta;
|
s->iir_temp += error * s->beta;
|
||||||
|
fprintf(stderr, " error = %f, dphase = %f, nco_phase = %f\n", error, s->dphase, s->nco_phase);
|
||||||
|
|
||||||
//step NCO
|
//step NCO
|
||||||
s->nco_phase += s->dphase;
|
s->nco_phase += s->dphase;
|
||||||
while(s->nco_phase>2*PI) s->nco_phase-=2*PI;
|
while(s->nco_phase>2*PI) s->nco_phase-=2*PI;
|
||||||
|
while(s->nco_phase<=0) s->nco_phase+=2*PI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue