求助程序解释!
时间:10-02
整理:3721RD
点击:
AD转换数字电压表,主程序里面这段滤波消除抖动是什么意思啊,怎么实现的啊,求大神告知。AD_in是AD转换后的信号。
for(;;)
{
delay();
AD_in = AD_capture();
AD_final = AD_final*7/8+AD_in/8; //滤波以消除抖动
cycle+=1;
if(cycle>=500)
{
cycle=0;
//计算电压的显示值的各位
dianya=(unsigned int)((unsigned long)AD_final*5000/4095);
data1 = dianya/1000;
data2 = (dianya%1000)/100;
data3 = (dianya%100)/10;
data4 = dianya%10;
data1 = data1+10; //加小数点
}
}
}
for(;;)
{
delay();
AD_in = AD_capture();
AD_final = AD_final*7/8+AD_in/8; //滤波以消除抖动
cycle+=1;
if(cycle>=500)
{
cycle=0;
//计算电压的显示值的各位
dianya=(unsigned int)((unsigned long)AD_final*5000/4095);
data1 = dianya/1000;
data2 = (dianya%1000)/100;
data3 = (dianya%100)/10;
data4 = dianya%10;
data1 = data1+10; //加小数点
}
}
}
没人吗