FIR filter using DSP instructions for ST Nucleo F401RE.

Dependencies:   UITDSP_ADDA mbed

Revision:
1:a2ca73edd772
Parent:
0:797a9c10261e
Child:
3:bfb6d1e6deee
--- a/main.cpp	Wed Oct 22 02:11:49 2014 +0000
+++ b/main.cpp	Wed Oct 22 05:17:24 2014 +0000
@@ -2,7 +2,7 @@
 // FIR フィルタ,基本的な構造, 固定小数点演算用 DSP 命令を使う
 //      Analog Input : A0
 //      Analog Output: MCP4922 using SPI
-// 2014/10/21, Copyright (c) 2014 MIKAMI, Naoki
+// 2014/10/22, Copyright (c) 2014 MIKAMI, Naoki
 //--------------------------------------------------------------
 
 #include "mbed.h"
@@ -41,7 +41,7 @@
         for (int k=ORDER_; k>0; k--)
             xn[k] = xn[k-1];        // move input signals
 
-        yn = (yn + 0x8000) >> 16;   // rounding and devide by 32768
+        yn = (yn + 0x8000) >> 15;   // rounding and devide by 32768
         //-----------------------------------------------
         myDac_.Write((uint16_t)(yn + 2047));    // Write to DAC
     }