Help with Biquad Filter
Posted: Thu Dec 27, 2018 9:19 am
Hi All.
I have a problem, where I need a moveable LowPass filter, where it is f0 that is moved between 500Hz. and as close as possible to the full 15KHz. bandwith (32.768Hz. Clock). I tried a simple BiQuad filter I partly pinched from SpinCAD (thanks Larry). :
equ Frequency REG4 ; Tone (Low Pass) Frequency (f0)
equ LowPass REG5 ;
equ BandPass REG6 ;
equ DelayOut REG7
; ------ biquad filter ------------------------------------------------------------------------------
RDAX POT0 ,1 ; Read Tone Pot
SOF 0.22 , -0.35 ; Shift Value : -.13 - -.35 => 100Hz. - 6.3KHz.
EXP 1 , 0 ; Expand to Range : 0.7046 ~ 100Hz. , 1 ~ 15KHz.
; 0.7046 ~ 100Hz. , 0.8783 ~ 6350Hz. - MAX OK value
WRAX Frequency , 0 ; Store as Frequency Factor
; ------ Filter Rutine starts here ---------------
RDAX BandPass , 1 ; Read old BandPass Register / Integrator Value
MULX Frequency ; Multiply with Frequency Gain Value
RDAX LowPass , 1 ; Read LowPass Register / Integrator Value
WRAX LowPass , 0 ; and ADD them for later
RDAX BandPass , -1 ; Read BandPass and Invert (-Q=1)
RDAX LowPass , -1 ; ADD LowPass Inverted
RDAX ADCL , 1
; ACC = High Pass Output here if needed.
MULX Frequency
RDAX BandPass , 1 ; Read BandPass Register / Integrator Value
WRAX BandPass , 0 ; and ADD them for later
; -------------------------------------------------------------------------------------------------------
LDAX LowPass
WRAX DACL , 0
EOP:
I have limited the max f0 as the Output "wobles when viewed on a scope" if f0 is higher than 6350 Hz. - any quick replies as to why ?
I read in some other posts here that this filter has problems below 500Hz. but I haven't seen any ….
The Digital representation is extremely similar to the Analog counterpart, and the Analog version can have the Input anywhere in the "chain" as this only moves where the Outputs are - this is sometimes useful in the Analog version - does it make sense in the Digital version too ?
I can live with a Q that is a bit higher or lower if this helps. Another filter type that solves my problem is fine too - thanks.
I have a problem, where I need a moveable LowPass filter, where it is f0 that is moved between 500Hz. and as close as possible to the full 15KHz. bandwith (32.768Hz. Clock). I tried a simple BiQuad filter I partly pinched from SpinCAD (thanks Larry). :
equ Frequency REG4 ; Tone (Low Pass) Frequency (f0)
equ LowPass REG5 ;
equ BandPass REG6 ;
equ DelayOut REG7
; ------ biquad filter ------------------------------------------------------------------------------
RDAX POT0 ,1 ; Read Tone Pot
SOF 0.22 , -0.35 ; Shift Value : -.13 - -.35 => 100Hz. - 6.3KHz.
EXP 1 , 0 ; Expand to Range : 0.7046 ~ 100Hz. , 1 ~ 15KHz.
; 0.7046 ~ 100Hz. , 0.8783 ~ 6350Hz. - MAX OK value
WRAX Frequency , 0 ; Store as Frequency Factor
; ------ Filter Rutine starts here ---------------
RDAX BandPass , 1 ; Read old BandPass Register / Integrator Value
MULX Frequency ; Multiply with Frequency Gain Value
RDAX LowPass , 1 ; Read LowPass Register / Integrator Value
WRAX LowPass , 0 ; and ADD them for later
RDAX BandPass , -1 ; Read BandPass and Invert (-Q=1)
RDAX LowPass , -1 ; ADD LowPass Inverted
RDAX ADCL , 1
; ACC = High Pass Output here if needed.
MULX Frequency
RDAX BandPass , 1 ; Read BandPass Register / Integrator Value
WRAX BandPass , 0 ; and ADD them for later
; -------------------------------------------------------------------------------------------------------
LDAX LowPass
WRAX DACL , 0
EOP:
I have limited the max f0 as the Output "wobles when viewed on a scope" if f0 is higher than 6350 Hz. - any quick replies as to why ?
I read in some other posts here that this filter has problems below 500Hz. but I haven't seen any ….
The Digital representation is extremely similar to the Analog counterpart, and the Analog version can have the Input anywhere in the "chain" as this only moves where the Outputs are - this is sometimes useful in the Analog version - does it make sense in the Digital version too ?
I can live with a Q that is a bit higher or lower if this helps. Another filter type that solves my problem is fine too - thanks.