The experiment using this program is introduced on "Interface" No.11, CQ publishing Co.,Ltd, 2014. 本プログラムを使った実験は,CQ出版社のインターフェース 2014年11月号で紹介しています.

Dependencies:   DSProcessingIO mbed

Fork of DAC_Test by CQpub0 Mikami

Revision:
1:339c82434d38
Parent:
0:f7880759a9d8
Child:
2:4bd5fbc225c3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main_ADDA.cpp	Tue Jul 15 05:28:03 2014 +0000
@@ -0,0 +1,33 @@
+//--------------------------------------------------------------
+//  Test program of DacDual class
+//
+//      Copyright (c) 2014 MIKAMI, Naoki, 2014/07/14
+//--------------------------------------------------------------
+
+#include "mbed.h"
+#include "AdcInternal.hpp"
+#include "MCP4922Dual.hpp"
+
+using namespace Mikami;
+
+const float FS_ = 10.0e3f;  // sampling frequency: 10 kHz
+
+Adc adc_;       // default, input: A0
+DacDual dacAB_; // object of DacDual class
+Ticker timer_;  // for timer interrupt
+
+// Called every 0.1 ms
+void TimerIsr()
+{
+    float value = adc_.Read();  // AD
+    
+    // pin14 : Inphase 
+    // pin10 : Out-of-phase
+    dacAB_.Write(value, -value);
+}
+
+int main()
+{
+    timer_.attach_us(&TimerIsr, 1.0e6f/FS_);
+    while (true) {} // infinite loop
+}