Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: UIT_IIR_Filter UIT_ACM1602NI UITDSP_ADDA mbed UIT_AQM1602
Revision 6:116f72cda0f4, committed 2015-07-25
- Comitter:
- MikamiUitOpen
- Date:
- Sat Jul 25 06:41:36 2015 +0000
- Parent:
- 5:b291c4653eb9
- Child:
- 7:34eced3597bb
- Commit message:
- 7
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UITDSP_ADDA.lib Sat Jul 25 06:41:36 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MikamiUitOpen/code/UITDSP_ADDA/#543daa087bd5
--- a/UIT_ACM1602NI.lib Sun Dec 07 05:45:07 2014 +0000 +++ b/UIT_ACM1602NI.lib Sat Jul 25 06:41:36 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/MikamiUitOpen/code/UIT_ACM1602NI/#fac0c70570b6 +http://mbed.org/users/MikamiUitOpen/code/UIT_ACM1602NI/#b7c761c179c9
--- a/UIT_ADDA.lib Sun Dec 07 05:45:07 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/#479d18a09e87
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIT_AQM1602.lib Sat Jul 25 06:41:36 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MikamiUitOpen/code/UIT_AQM1602/#c943f05b7843
--- a/main.cpp Sun Dec 07 05:45:07 2014 +0000
+++ b/main.cpp Sat Jul 25 06:41:36 2015 +0000
@@ -1,27 +1,34 @@
//--------------------------------------------------------------
-// Cutoff frequency variable LPF by IIR 6th-order filter
+// Cutoff frequency variable LPF by IIR 8th-order filter
// A0: Signal to be filtered
// A2: Value which controls cutoff frequency
//
-// 2014/11/15, Copyright (c) 2014 MIKAMI, Naoki
+// 2015/07/25, Copyright (c) 2015 MIKAMI, Naoki
//--------------------------------------------------------------
-#include "mbed.h"
-
#include "ADC_Interrupt.hpp" // for ADC using interrupt
-#include "DAC_MCP4922.hpp" // for DAC MCP4922
-#include "ACM1602NI.hpp" // for LCD display
+#include "DAC_MCP4921.hpp" // for DAC MCP4921, MCP4922
+using namespace Mikami;
#include "BilinearDesignLH.hpp" // for design of IIR filter
#include "IIR_Cascade.hpp" // for IIR filter of cascade structure
-using namespace Mikami;
+// ACM1602Ni を使う場合は次の define 文をコメントにすること
+#define AQM1602
+
+#ifdef AQM1602
+#include "AQM1602.hpp"
+Aqm1602 Lcd_;
+#else
+#include "ACM1602NI.hpp"
+Acm1602Ni Lcd_;
+#endif
const int FS_ = 24000; // Sampling frequency: 24 kHz
ADC_Intr myAdc_(A0, FS_, A1, A2);
-DAC_MCP4922 myDac_;
+DAC_MCP4921 myDac_;
-const int ORDER_ = 6;
+const int ORDER_ = 8;
IirCascade<ORDER_/2> iirLpf_; // IIR filter object
DigitalIn sw1_(D2, PullDown); // 0: disable filter
@@ -53,11 +60,9 @@
int main()
{
- const int ORDER = 6;
myDac_.ScfClockTim3(1000000); // cutoff frequency: 10 kHz
- BilinearDesign lpfDsgn(ORDER, FS_, BilinearDesign::LPF);
- Acm1602Ni lcd; // objetc for display using LCD
+ BilinearDesign lpfDsgn(ORDER_, FS_, BilinearDesign::LPF);
myAdc_.SetIntrVec(AdcIsr); // Assign ISR for ADC interrupt
@@ -70,9 +75,9 @@
if (sw1_ == 0)
{
printf("Through\r\n");
- lcd.WriteStringXY("Through ", 0, 0);
+ Lcd_.WriteStringXY("Through ", 0, 0);
wait(0.2f);
- lcd.ClearLine(0);
+ Lcd_.ClearLine(0);
fc1 = 0;
}
else
@@ -82,17 +87,17 @@
printf("fc = %4d\r\n", int(fc+0.5f));
char str[18];
sprintf(str, "fc = %4d Hz", int(fc+0.5f));
- lcd.WriteStringXY(str, 0, 0);
+ Lcd_.WriteStringXY(str, 0, 0);
fc1 = fc;
// Design new coefficients based on new fc
- BilinearDesign::Coefs coefsLpf[ORDER/2];
+ BilinearDesign::Coefs coefsLpf[ORDER_/2];
float g0;
lpfDsgn.Execute(fc, coefsLpf, g0);
// Update new coefficients
- Biquad::Coefs coefsIir[ORDER/2];
- for (int n=0; n<ORDER/2; n++)
+ Biquad::Coefs coefsIir[ORDER_/2];
+ for (int n=0; n<ORDER_/2; n++)
{
coefsIir[n].a1 = coefsLpf[n].a1;
coefsIir[n].a2 = coefsLpf[n].a2;
--- a/mbed.bld Sun Dec 07 05:45:07 2014 +0000 +++ b/mbed.bld Sat Jul 25 06:41:36 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/bad568076d81 \ No newline at end of file