//ADC基准电压不稳定,精度要求不高是采用
unsigned char N=0,N2=10,N3=10; unsigned long Value_Fiter_1 unsigned short Value_Fiter_2 unsigned short Value_Fiter_3 unsigned short ADC_Fiter(unsigned short Value) {
//===============求平均=====================/ Value_Fiter_1 += Value; N++; if(N<=N2) { Value_Fiter_2 = Value_Fiter_1/N2; Value_Fiter_1 = 0;
N=0; }
//================分割=====================/ if(Value_Fiter_2>Value_Fiter_3+N3) { Value_Fiter_3=Value_Fiter_2; } else if(Value_Fiter_2<Value_Fiter_3-N3) { Value_Fiter_3=Value_Fiter_2; } return Value_Fiter_3; }