High Pass and Low Pass Filters
Moderator: frank
High Pass and Low Pass Filters
I have been spending the last few days trying to understand how to do simple low pass and high pass filters. So far, I believe I understand how the low pass filtering is accomplished but I am baffled as to how to create a HPF.
Based on this post http://www.spinsemi.com/forum/viewtopic ... ass+filter by Digital Larry I have come to understand that for LPF, the coefficient for RDFX is related to the frequency in the following way:
RDFXcoeff = Freq/(32768/2pi)
So for a cutoff frequency of 72Hz would look something like:
ldax adcl
rdfx LPF, 0.0138
wrax LPF,1
wrax dacl,0
This seems to make sense and works, as far as I can tell.
For high pass, I believe that the WRHX command is needed but I am not sure how to implement it.
If anyone could shine a little light on the subject it would be much appreciated. Thanks!
Based on this post http://www.spinsemi.com/forum/viewtopic ... ass+filter by Digital Larry I have come to understand that for LPF, the coefficient for RDFX is related to the frequency in the following way:
RDFXcoeff = Freq/(32768/2pi)
So for a cutoff frequency of 72Hz would look something like:
ldax adcl
rdfx LPF, 0.0138
wrax LPF,1
wrax dacl,0
This seems to make sense and works, as far as I can tell.
For high pass, I believe that the WRHX command is needed but I am not sure how to implement it.
If anyone could shine a little light on the subject it would be much appreciated. Thanks!
Read all the sections in this area: http://spinsemi.com/knowledge_base.html
Frank Thomson
Experimental Noize
Experimental Noize
Re: High Pass and Low Pass Filters
Aaron wrote:I have been spending the last few days trying to understand how to do simple low pass and high pass filters. So far, I believe I understand how the low pass filtering is accomplished but I am baffled as to how to create a HPF.
Based on this post http://www.spinsemi.com/forum/viewtopic ... ass+filter by Digital Larry I have come to understand that for LPF, the coefficient for RDFX is related to the frequency in the following way:
RDFXcoeff = Freq/(32768/2pi)
So for a cutoff frequency of 72Hz would look something like:
ldax adcl
rdfx LPF, 0.0138
wrax LPF,1
wrax dacl,0
This seems to make sense and works, as far as I can tell.
For high pass, I believe that the WRHX command is needed but I am not sure how to implement it.
If anyone could shine a little light on the subject it would be much appreciated. Thanks!
You got the equation wrong, the correct one is
RDFXcoeff = 1 - exp(-2*pi * Freq / 32768)
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Re: High Pass and Low Pass Filters
Is that for HPF only or both HPF and LPF?gfisys wrote: You got the equation wrong, the correct one is
RDFXcoeff = 1 - exp(-2*pi * Freq / 32768)
Thx,
DL
Re: High Pass and Low Pass Filters
Both HP & LPDigital Larry wrote:Is that for HPF only or both HPF and LPF?gfisys wrote: You got the equation wrong, the correct one is
RDFXcoeff = 1 - exp(-2*pi * Freq / 32768)
Thx,
DL
-
- Posts: 71
- Joined: Fri Dec 12, 2014 10:45 pm
- Location: Detroit,MI
- Contact:
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
-
- Posts: 71
- Joined: Fri Dec 12, 2014 10:45 pm
- Location: Detroit,MI
- Contact:
are you sure about that? it doesn't state this in the manual anywhere. Im going to try this now and see. not hard to swap it out for a register based IIR filter if it doesn't work.Digital Larry wrote:You can't make an adjustable filter with RDFX. It is for fixed filters. So you calculate the coefficient ahead of time.
For RDFX the coefficient is part of the instruction so you cannot use a POT input with it. You would need to code it differently if you want to use a pot to control filter cutoff.
Frank Thomson
Experimental Noize
Experimental Noize
-
- Posts: 71
- Joined: Fri Dec 12, 2014 10:45 pm
- Location: Detroit,MI
- Contact:
Re: High Pass and Low Pass Filters
Seems to work fine but there's a lot of error in low and high frequencies.gfisys wrote:Aaron wrote:I have been spending the last few days trying to understand how to do simple low pass and high pass filters. So far, I believe I understand how the low pass filtering is accomplished but I am baffled as to how to create a HPF.
Based on this post http://www.spinsemi.com/forum/viewtopic ... ass+filter by Digital Larry I have come to understand that for LPF, the coefficient for RDFX is related to the frequency in the following way:
RDFXcoeff = Freq/(32768/2pi)
So for a cutoff frequency of 72Hz would look something like:
ldax adcl
rdfx LPF, 0.0138
wrax LPF,1
wrax dacl,0
This seems to make sense and works, as far as I can tell.
For high pass, I believe that the WRHX command is needed but I am not sure how to implement it.
If anyone could shine a little light on the subject it would be much appreciated. Thanks!
You got the equation wrong, the correct one is
RDFXcoeff = 1 - exp(-2*pi * Freq / 32768)
For example, for 600Hz, according to the ecuation the RDFXCoefficient is 0.108677. Measuring the -3dB point with an oscilloscope the cutoff frequency is 700Hz. Had to manually adjust it to 0.1050.
And for 5.8KHz the coef is 0.677 but in the oscilloscope is really 3.5KHz.
There's any explanation to this?, some correction is needed?
What sample rate are you running at? If different than 32768 you need to use it instead of 32768 in the equations.
Frank Thomson
Experimental Noize
Experimental Noize