Prototype program of AD and DA using classes in UIT_ADDA. This program uses interrupt of ADC for ST Nucleo F401RE. UIT_ADDA のクラスを使った AD および DA のためのプログラムの雛形.ADC の割り込みを使うバージョン.ST Nucleo F401 用.

Dependencies:   UIT_ADDA mbed

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Mon Oct 20 07:59:05 2014 +0000
Child:
1:e5e7a45f0cd6
Commit message:
1

Changed in this revision

UIT_ACM1602NI.lib Show annotated file Show diff for this revision Revisions of this file
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_ACM1602NI.lib	Mon Oct 20 07:59:05 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/MikamiUitOpen/code/UIT_ACM1602NI/#d8048b36d982
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UIT_ADDA.lib	Mon Oct 20 07:59:05 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/MikamiUitOpen/code/UIT_ADDA/#6e0ed5adfe47
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 20 07:59:05 2014 +0000
@@ -0,0 +1,37 @@
+//--------------------------------------------------------------
+// 割り込みを使って AD DA を行う場合の雛形1(入力:1 チャンネル)
+//      Analog Input : A0
+//      Analog Output: MCP4922 using SPI
+// 2014/10/20, Copyright (c) 2014 MIKAMI, Naoki
+//--------------------------------------------------------------
+
+#include "mbed.h"
+
+#include "ADC_Interrupt.hpp"    // for ADC using interrupt
+#include "DAC_MCP4922.hpp"      // for DAC MCP4922
+#include "ScfClockTim3.hpp"     // for clock supplied to SCF
+
+using namespace Mikami;
+
+const int FS_ = 10000;          // Sampling frequency: 24 kHz
+ADC_Intr adc_(A0, FS_, A1, A2);         // for AD
+DAC_MCP4922 myDac_(DAC_MCP4922::DAC_A); // for DA
+
+uint16_t a2_ = 0;
+uint16_t a21_ = 0;
+float vol_ = 1.0f;
+
+// Interrupt service routine for ADC
+void AdcIsr()
+{   
+    float xn = adc_.Read(); // Read from A0
+    myDac_.Write(xn);       // to DAC
+}
+
+int main()
+{
+    ScfClockTim3(420000);      // cutoff frequency: 4.2 kHz
+    adc_.SetIntrVec(AdcIsr);    // Assign ISR for ADC interrupt
+
+    while (true) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 20 07:59:05 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file