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_ACM1602NI UIT_ADDA mbed
Revision 0:096d748fede9, committed 2014-12-26
- Comitter:
- MikamiUitOpen
- Date:
- Fri Dec 26 00:30:30 2014 +0000
- Commit message:
- 1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIT_ACM1602NI.lib Fri Dec 26 00:30:30 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MikamiUitOpen/code/UIT_ACM1602NI/#b911485a6f4d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIT_ADDA.lib Fri Dec 26 00:30:30 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MikamiUitOpen/code/UIT_ADDA/#6c60601c1834
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Dec 26 00:30:30 2014 +0000
@@ -0,0 +1,49 @@
+//--------------------------------------------------------------
+// 入力の切り替え(ラインとマイク),LCD 表示 ---- 割り込み利用
+// Analog Input : A0
+// Analog Output: MCP4922 using SPI
+// 2014/12/26, Copyright (c) 2014 MIKAMI, Naoki
+//--------------------------------------------------------------
+
+#include "ADC_Interrupt.hpp" // for ADC using interrupt
+#include "DAC_MCP4922.hpp" // for DAC MCP4922
+#include "ACM1602NI.hpp" // for LCD
+
+using namespace Mikami;
+
+const int FS_ = 10000; // Sampling frequency: 10 kHz
+ADC_Intr adc_(A0, FS_, A1); // CH1: Line, CH2: Mic
+DAC_MCP4922 myDac_; // for DA
+DigitalIn sw_(D2, PullDown); // for SW
+Acm1602Ni lcd_; // for LCD
+
+// Interrupt service routine for ADC
+void AdcIsr()
+{
+ float xn = adc_.Read(); // Read from A0
+ myDac_.Write(xn); // to DAC
+}
+
+int main()
+{
+ lcd_.Clear();
+ myDac_.ScfClockTim3(420000); // cutoff frequency: 4.2 kHz
+ adc_.SetIntrVec(AdcIsr); // Assign ISR for ADC interrupt
+
+ int swBefore = 0;
+
+ while (true)
+ {
+ int swNow = sw_.read();
+ if (swNow != swBefore)
+ {
+ if (swNow == 0) adc_.Select1stChannel(); // line input
+ else adc_.Select2ndChannel(); // mic. input
+ swBefore = swNow;
+ }
+
+ if (swNow == 0) lcd_.WriteStringXY("Input: Line", 0, 0);
+ else lcd_.WriteStringXY("Input: Mic ", 0, 0);
+ wait(0.1f);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 26 00:30:30 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file