FIR filter of Direct form for ST Nucleo F401RE.

Dependencies:   UITDSP_ADDA mbed

Revision:
6:5a7e4d3d786a
Parent:
4:32b07aecbc14
Child:
8:927d97f834b0
diff -r a846a7bd2bef -r 5a7e4d3d786a main.cpp
--- a/main.cpp	Mon Nov 10 09:55:08 2014 +0000
+++ b/main.cpp	Wed Nov 12 09:48:06 2014 +0000
@@ -2,14 +2,13 @@
 // FIR フィルタ,基本的な構造
 //      Analog Input : A0
 //      Analog Output: MCP4922 using SPI
-// 2014/10/23, Copyright (c) 2014 MIKAMI, Naoki
+// 2014/11/12, Copyright (c) 2014 MIKAMI, Naoki
 //--------------------------------------------------------------
 
 #include "mbed.h"
 
 #include "ADC_Base.hpp"         // for ADC not using interrupt
 #include "DAC_MCP4922.hpp"      // for DAC MCP4922
-#include "ScfClockTim3.hpp"     // for clock supplied to SCF
 #include "Coefficients_200_LPF.hpp"
 
 using namespace Mikami;
@@ -20,7 +19,7 @@
 
 int main()
 {
-    ScfClockTim3(500000);       // cutoff frequency: 5 kHz
+    myDac_.ScfClockTim3(500000);    // cutoff frequency: 5 kHz
 
     float xn[ORDER_+1];
     for (int n=0; n<=ORDER_; n++)
@@ -28,7 +27,7 @@
     
     while (true)
     {
-        xn[0] = adc_.Read();     // Read from A0
+        xn[0] = adc_.Read();    // Read from A0
         //-----------------------------------------------
 
         float yn = 0;
@@ -36,9 +35,9 @@
             yn = yn + hm_[k]*xn[k];
 
         for (int k=ORDER_; k>0; k--)
-            xn[k] = xn[k-1];  // move input signals
+            xn[k] = xn[k-1];    // move input signals
 
         //-----------------------------------------------
-        myDac_.Write(yn);    // Write to DAC
+        myDac_.Write(yn);       // Write to DAC
     }
 }