不韋 呂 / Mbed 2 deprecated UIT2_IIR_1stOrder

Dependencies:   UIT_ADDA mbed

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Wed Oct 29 09:46:52 2014 +0000
Child:
1:e6237765465f
Commit message:
1

Changed in this revision

UIT_ADDA.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UIT_ADDA.lib	Wed Oct 29 09:46:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/MikamiUitOpen/code/UIT_ADDA/#77bc5550dc10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 29 09:46:52 2014 +0000
@@ -0,0 +1,38 @@
+//--------------------------------------------------------------
+// 1次の IIR フィルタ
+//      Analog Input : A0
+//      Analog Output: MCP4922 using SPI
+// 2014/10/29, 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
+
+using namespace Mikami;
+
+const int FS_ = 12000;  // Sampling frequency: 12 kHz
+ADC_Base adc_(A0, FS_); // for AD
+DAC_MCP4922 myDac_;     // for DA
+
+int main()
+{
+    ScfClockTim3(500000);       // cutoff frequency: 5 kHz
+
+    const float A1 = 0.8f;
+    const float B0 = 1.0f - A1;
+    float yn = 0;
+    
+    while (true)
+    {
+        float xn = adc_.Read();     // Read from A0
+        //-----------------------------------------------
+
+        yn = A1*yn + B0*xn;
+
+        //-----------------------------------------------
+        myDac_.Write(yn);           // Write to DAC
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 29 09:46:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file