资 源 简 介
10种软件滤波方法的示例程序
1、限副滤波
/* A值可根据实际情况调整
value为有效值,new_value为当前采样值
滤波程序返回有效的实际值 */
#define A 10
char value
char filter()
{
char new_value
new_value = get_ad()
if ( ( new_value - value > A ) || ( value - new_value > A )
return value
return new_value
}
2、中位值滤波法
/* N值可根据实际情况调整
排序采用冒泡法*/-10 kinds of software filtering method one example of the procedure, limit the Deputy filter/* A value can be adjusted according to the actual value for the RMS, new_value filter for the current sampling procedures for the effective return of the actual value* /# define A 10 char value char filter () (char new_value new_value = get_ad () if ((new_value- value> A) | | (value- new_value> A) return value return new_value ) 2, the median filtering method/* N values can be adjust the actual situation in the use of bubble sort method* /