|
简单的数字滤波器的运用
对输入信号进行滤波:
运用两个3bit的加法器进行hall_sychrous滤波count_hall_highlevel,count_hall_downlevel;
原理简单,但是优化的外部信号,保证了信号平稳。
//exter_sign_sychrous
//count_exter_sign_highlevel[3:1]
always @(posedge clk_sys_40m)
begin
if(exter_sign_sychrous)
begin
count_exter_sign_highlevel<=count_exter_sign_highlevel+1;
end
else
if(count_exter_sign_highlevel==3'd0)
count_exter_sign_highlevel<=3'd0;
else
count_exter_sign_highlevel<=count_exter_sign_highlevel-1;
end
//--------------------------------
//count_exter_sign_downlevel[3:1]
always @(posedge clk_sys_40m)
begin
if(!exter_sign_sychrous)
begin
count_exter_sign_downlevel<=count_exter_sign_downlevel+1;
end
else
if(count_exter_sign_downlevel==3'd0)
count_exter_signl_downlevel<=3'd0;
else
count_exter_sign_downlevel<=count_exter_sign_downlevel-1;
end
///