![]() |
RTOS_MSPM0
1.1
ECE445M starter code
|
implements four FIR low-pass filters More...
#include <stdint.h>Go to the source code of this file.
Functions | |
| uint32_t | sqrt2 (uint32_t s) |
| square root More... | |
| void | LPF_Init (int32_t initial, int32_t size) |
| Initialize first LPF. More... | |
| int32_t | LPF_Calc (int32_t newdata) |
| FIR low pass filter. More... | |
| int32_t | Noise1 (void) |
| void | LPF_Init2 (int32_t initial, int32_t size) |
| Initialize second LPF. More... | |
| int32_t | LPF_Calc2 (int32_t newdata) |
| FIR low pass filter. More... | |
| int32_t | Noise2 (void) |
| void | LPF_Init3 (int32_t initial, int32_t size) |
| Initialize third LPF. More... | |
| int32_t | LPF_Calc3 (int32_t newdata) |
| FIR low pass filter. More... | |
| int32_t | Noise3 (void) |
| void | LPF_Init4 (int32_t initial, int32_t size) |
| Initialize third LPF. More... | |
| int32_t | LPF_Calc4 (int32_t newdata) |
| FIR low pass filter. More... | |
| int32_t | Noise4 (void) |
| void | LPF_Init5 (int32_t initial, int32_t size) |
| Initialize fifth LPF. More... | |
| int32_t | LPF_Calc5 (int32_t newdata) |
| FIR low pass filter. More... | |
| int32_t | Noise5 (void) |
| void | LPF_Init6 (int32_t initial, int32_t size) |
| Initialize Sixth LPF. More... | |
| int32_t | LPF_Calc6 (int32_t newdata) |
| FIR low pass filter. More... | |
| int32_t | Noise6 (void) |
| void | LPF_Init7 (int32_t initial, int32_t size) |
| Initialize Seventh LPF. More... | |
| int32_t | LPF_Calc7 (int32_t newdata) |
| FIR low pass filter. More... | |
| int32_t | Noise7 (void) |
| int32_t | Median (int32_t newdata) |
| Median filter. More... | |
| int32_t | Median5 (int32_t newdata) |
| Median filter. More... | |
| int32_t | Median7 (int32_t newdata) |
| Median filter. More... | |
| int32_t | Filter (int32_t data) |
| 60-Hz notch high-Q, IIR filter More... | |
implements four FIR low-pass filters
Finite length LPF
1) Size is the depth 2 to 16
2) y(n) = (sum(x(n)+x(n-1)+...+x(n-size-1))/size
3) To use a filter
a) initialize it once
b) call the filter at the sampling rate
| int32_t Filter | ( | int32_t | data | ) |
60-Hz notch high-Q, IIR filter
60-Hz notch high-Q, alpha=0.99, IIR filter, assuming fs=1000 Hz.
y(n) = (256x(n) -503x(n-1) + 256x(n-2) + 498y(n-1)-251y(n-2))/256 (2k sampling)
y(n) = (256x(n) -476x(n-1) + 256x(n-2) + 471y(n-1)-251y(n-2))/256 (1k sampling)
| data | new ADC data |
| int32_t LPF_Calc | ( | int32_t | newdata | ) |
FIR low pass filter.
First LPF, calculate one filter output
Called at sampling rate
| newdata | new ADC data |
| int32_t LPF_Calc2 | ( | int32_t | newdata | ) |
FIR low pass filter.
Second LPF, calculate one filter output
Called at sampling rate
| newdata | new ADC data |
| int32_t LPF_Calc3 | ( | int32_t | newdata | ) |
FIR low pass filter.
Third LPF, calculate one filter output
Called at sampling rate
| newdata | new ADC data |
| int32_t LPF_Calc4 | ( | int32_t | newdata | ) |
FIR low pass filter.
Fourth LPF, calculate one filter output
Called at sampling rate
| newdata | new ADC data |
| int32_t LPF_Calc5 | ( | int32_t | newdata | ) |
FIR low pass filter.
fifth LPF, calculate one filter output
Called at sampling rate
| newdata | new ADC data |
| int32_t LPF_Calc6 | ( | int32_t | newdata | ) |
FIR low pass filter.
Sixth LPF, calculate one filter output
Called at sampling rate
| newdata | new ADC data |
| int32_t LPF_Calc7 | ( | int32_t | newdata | ) |
FIR low pass filter.
Seventh LPF, calculate one filter output
Called at sampling rate
| newdata | new ADC data |
| void LPF_Init | ( | int32_t | initial, |
| int32_t | size | ||
| ) |
Initialize first LPF.
Initialize first LPF
Set all data to an initial value
| initial | value to preload into MACQ |
| size | depth of the filter, 2 to 16 |
| void LPF_Init2 | ( | int32_t | initial, |
| int32_t | size | ||
| ) |
Initialize second LPF.
Initialize second LPF
Set all data to an initial value
| initial | value to preload into MACQ |
| size | depth of the filter, 2 to 16 |
| void LPF_Init3 | ( | int32_t | initial, |
| int32_t | size | ||
| ) |
Initialize third LPF.
Initialize third LPF
Set all data to an initial value
| initial | value to preload into MACQ |
| size | depth of the filter, 2 to 16 |
| void LPF_Init4 | ( | int32_t | initial, |
| int32_t | size | ||
| ) |
Initialize third LPF.
Initialize fourth LPF
Set all data to an initial value
| initial | value to preload into MACQ |
| size | depth of the filter, 2 to 16 |
| void LPF_Init5 | ( | int32_t | initial, |
| int32_t | size | ||
| ) |
Initialize fifth LPF.
Initialize fifth LPF
Set all data to an initial value
| initial | value to preload into MACQ |
| size | depth of the filter, 2 to 16 |
| void LPF_Init6 | ( | int32_t | initial, |
| int32_t | size | ||
| ) |
Initialize Sixth LPF.
Initialize Sixth LPF
Set all data to an initial value
| initial | value to preload into MACQ |
| size | depth of the filter, 2 to 16 |
| void LPF_Init7 | ( | int32_t | initial, |
| int32_t | size | ||
| ) |
Initialize Seventh LPF.
Initialize Seventh LPF
Set all data to an initial value
| initial | value to preload into MACQ |
| size | depth of the filter, 2 to 16 |
| int32_t Median | ( | int32_t | newdata | ) |
Median filter.
3-wide non recursive Median filter
Called with new data at sampling rate
| newdata | new ADC data |
| int32_t Median5 | ( | int32_t | newdata | ) |
Median filter.
5-wide non recursive Median filter
Called with new data at sampling rate
| newdata | new ADC data |
| int32_t Median7 | ( | int32_t | newdata | ) |
Median filter.
7-wide non recursive Median filter
Called with new data at sampling rate
| newdata | new ADC data |
| uint32_t sqrt2 | ( | uint32_t | s | ) |
square root
Newton's method sqrt
| s | is an integer |