i am using this code for FIR filter
****************************************
#define Ntap 31
#define DCgain 32768
__int16 fir(__int16 NewSample) {
__int16 FIRCoef[Ntap] = {
-40,
-44,
74,
79,
-141,
-143,
273,
257,
-548,
-452,
1169,
738,
-2767,
-1035,
10172,
17581,
10172,
-1035,
-2767,
738,
1169,
-452,
-548,
257,
273,
-143,
-141,
79,
74,
-44,
-40
};
static __int16 x[Ntap]; //input samples
__int32 y=0; //output sample
int n;
//shift the old samples
for(n=Ntap-1; n>0; n--)
x[n] = x[n-1];
//Calculate the new output
x[0] = NewSample;
for(n=0; n<Ntap; n++)
y += FIRCoef[n] * x[n];
return y / DCgain;
}
**********************************************
but when i divide the Y with Dcgain result is always 0 ,
i am using Mplab ide for simulation and CCS as compiler