FIR filter using fixed point arithmetic operations for ST Nucleo F401RE.
Dependencies: UITDSP_ADDA mbed
Revision 8:abd11816e480, committed 2015-11-16
- Comitter:
- MikamiUitOpen
- Date:
- Mon Nov 16 02:23:51 2015 +0000
- Parent:
- 7:1f6af7b67de4
- Commit message:
- 9
Changed in this revision
diff -r 1f6af7b67de4 -r abd11816e480 UITDSP_ADDA.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UITDSP_ADDA.lib Mon Nov 16 02:23:51 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MikamiUitOpen/code/UITDSP_ADDA/#14cdca8b48f8
diff -r 1f6af7b67de4 -r abd11816e480 UIT_ADDA.lib --- a/UIT_ADDA.lib Sat Nov 15 06:07:42 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/users/MikamiUitOpen/code/UIT_ADDA/#c326d04aa6b8
diff -r 1f6af7b67de4 -r abd11816e480 main.cpp --- a/main.cpp Sat Nov 15 06:07:42 2014 +0000 +++ b/main.cpp Mon Nov 16 02:23:51 2015 +0000 @@ -2,21 +2,19 @@ // FIR フィルタ,基本的な構造, 固定小数点演算を使う // Analog Input : A0 // Analog Output: MCP4922 using SPI -// 2014/11/12, Copyright (c) 2014 MIKAMI, Naoki +// 2015/11/16, Copyright (c) 2015 MIKAMI, Naoki //-------------------------------------------------------------- -#include "mbed.h" - -#include "ADC_Base.hpp" // for ADC not using interrupt -#include "DAC_MCP4922.hpp" // for DAC MCP4922 +#include "ADC_BuiltIn.hpp" // for ADC not using interrupt +#include "DAC_MCP4921.hpp" // for DAC MCP4921, MCP4922 #include "Coefficients_200_LPF_Fixed.hpp" using namespace Mikami; const int FS_ = 12000; // Sampling frequency: 12 kHz const uint16_t OFFSET = 2047; // Correspond to "0" -ADC_Base adc_(A0, FS_); // for AD -DAC_MCP4922 myDac_; // for DA +ADC_BuiltIn adc_(A0, FS_); // for AD +DAC_MCP4921 myDac_; // for DA int main() { @@ -39,7 +37,7 @@ xn[k] = xn[k-1]; // move input signals // rounding and devide by 32768 + DC offset - uint16_t yOut = ((yn + 0x8000) >> 15) + OFFSET; + uint16_t yOut = ((yn + 0x4000) >> 15) + OFFSET; //----------------------------------------------- myDac_.Write(yOut); // Write to DAC }
diff -r 1f6af7b67de4 -r abd11816e480 mbed.bld --- a/mbed.bld Sat Nov 15 06:07:42 2014 +0000 +++ b/mbed.bld Mon Nov 16 02:23:51 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file