標(biāo)題: 請(qǐng)教限幅消抖濾波問題 [打印本頁]

作者: samxon    時(shí)間: 2024-12-12 10:54
標(biāo)題: 請(qǐng)教限幅消抖濾波問題


請(qǐng)教大家,下面代碼中的value是不是要先定義,這個(gè)value的值從哪里來。謝謝回復(fù)。


//限幅消抖濾波
unsigned int filter()
{
        static char a=10,N=12;
        unsigned int value;
        char new_value,count=0;
        new_value=getadc();
        while(value!=new_value)
        {
                        if(value-new_value<a||new_value-value<a)
                                {
                                        count++;
                                        if(count>=N) return new_value;
                                        new_value=getadc();                       
                                }
                return value;
        }       
}






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1