FIR filter using fixed point arithmetic operations for ST Nucleo F401RE.

Dependencies:   UITDSP_ADDA mbed

Revision:
1:152ee39babce
Parent:
0:da34e90f15a3
Child:
3:5c085430972b
--- a/main.cpp	Wed Oct 22 01:40:46 2014 +0000
+++ b/main.cpp	Wed Oct 22 05:16:20 2014 +0000
@@ -2,7 +2,7 @@
 // FIR フィルタ,基本的な構造, 固定小数点演算を使う
 //      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"
@@ -38,7 +38,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
     }