What do you have them connected to?am already connected 100ohm resistor to each pins of analog channel(0-7)...
float lp_filter(float new, int bn,int slow) // low pass filter, slow rate of change for new, 8 channels, slow/fast select
{
static float smooth[LPCHAN]={0},x;
float speed;
if (bn>LPCHAN) return new;
if (slow) {
speed=63.0/64.0;
} else {
speed=3.0/4.0;
}
x=new+(speed*(smooth[bn]-new));
smooth[bn]=x;
return x;
}
OpenADC( ADC_FOSC_RC &
ADC_RIGHT_JUST &
ADC_4_TAD,
ADC_CH2 &
ADC_REF_VDD_VSS &
ADC_INT_OFF , ADC_9ANA);
SetChanADC(ADC_CH5); // RF0 for input current AMP300
Delay10TCYx(250);
Vin=0;
for(i=0;i<64;i++)
{
ConvertADC();
while(BusyADC());
Vin += (unsigned int) ReadADC();
}
Vin /= 64;
CloseADC();
a300=Vin; // raw ADC value
Vin=Vin-AMP300_OF; // set zero null point
current=Vin*(ADC5_OFF-127+adc_cal[5]);
current=current/10;
current=current/AMP300_SEN;
current=(long)lp_filter((float)current,3,TRUE); // use digital filter on noisy sensor