This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

我调用ti的锁相环程序spll,但是无法锁定,不知为啥?

Other Parts Discussed in Thread: CONTROLSUITE

这是ti的锁相环,

这是要用到函数的声明:

void SPLL_1ph_IQ_init(int Grid_freq, long DELTA_T, SPLL_1ph_IQ *spll_obj);

void SPLL_1ph_IQ_notch_coeff_update(float delta_T, float wn,float c2, float c1, SPLL_1ph_IQ *spll_obj);

参数说明:

Wn  :       Input         Grid Frequency in radians/sec              (  IQ21 Float32);

delta_t:    internal    1/Frequency of calling the PLL routine    (  IQ21  Float32);

我在main函数写了个正弦表,来模拟交流采样,每隔200us,条用一下正弦表、spll,但是vco的输出的cos的值一直变化,无法锁相,这是为什么?

下面是我的程序:

SPLL_1ph_IQ_init(50,_IQ21((float)(0.0002)),&spll1);         //spll的初始化,0.0002是调用spll的时间

SPLL_1ph_IQ_notch_coeff_update(((float)(0.0002)),(float)(2*3.1415*50),(float)0.00001,(float)0.1,&spll1); //spll陷波滤波器的系数更新,50为电网频率

for(;;)
{
 bb=a1[n];                                     //调用正弦表,模拟交流输入,在0---1之间变化,相当于已经标幺化
 spll1.AC_input=SPLL_Q(bb);     //SPLL_Q(bb)是IQ21

 n=n+1;
if(n==101)                          //正弦表有100个

n=0;
delay_nop(200);                 //延时200us
SPLL_1ph_IQ_FUNC(&spll1); //调用spll

}