Hi!
i am using tms320f2808 to design a three phase voltage data acquizition system. the three phase grid voltage in conditioned in to 0~3V voltage and then is passed into the DSP's ADC pins。
so i want to filer the aquired singnal simultaneous using the FIR16 in the controlsuite?how can i do this?can i do this just like below?
#define FIR16_COEFF {\
1292,4261126,4654326,5440731,6751414,8455303,10749008,13501458,16712654,20382597,\
24445752,28902122,33620635,38601293,43713025,48890297,54002037,59048247,63832319,68288718,\
}
//#pragma DATA_SECTION(lpf1, "firfilt");
//#pragma DATA_SECTION(lpf2, "firfilt");
//#pragma DATA_SECTION(dbuffer1,"firldb");
//#pragma DATA_SECTION(dbuffer2,"firldb");
//long dbuffer1[(FIR_ORDER+2)/2];
long dbuffer2[(FIR_ORDER+2)/2];
long const coeff[(FIR_ORDER+2)/2] = FIR16_COEFF;
FIR16 lpf1 = FIR16_DEFAULTS; //Uab filtering
FIR16 lpf2 = FIR16_DEFAULTS; //Ubcfiltering
main()
{
/* lpf1.order=FIR_ORDER;
lpf1.dbuffer_ptr=dbuffer1;
lpf1.coeff_ptr=(long *)coeff;
lpf1.init(&lpf1);*/
lpf2.order=FIR_ORDER; //滤波器阶数
lpf2.dbuffer_ptr=dbuffer2; //循环缓冲区
lpf2.coeff_ptr=(long *)coeff; //滤波器系数
lpf2.init(&lpf2);
}
ISR()
{
lpf1.input = AdcGrid.Ch4Out; //Uab滤波
lpf1.calc(&lpf1);
Uab = _IQ15toIQ((long)lpf1.output);
lpf2.input = AdcGrid.Ch5Out; //Ubc滤波
lpf2.calc(&lpf2);
Ubc = _IQ15toIQ((long)lpf2.output);
}