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: DSProcessingIO mbed
Fork of DAC_Test by
main_ADDA.cpp
00001 //-------------------------------------------------------------- 00002 // Test program of DacDual class 00003 // 00004 // Copyright (c) 2014 MIKAMI, Naoki, 2014/07/14 00005 //-------------------------------------------------------------- 00006 00007 #include "mbed.h" 00008 #include "AdcInternal.hpp" 00009 #include "MCP4922Dual.hpp" 00010 00011 using namespace Mikami; 00012 00013 const float FS_ = 10.0e3f; // sampling frequency: 10 kHz 00014 00015 Adc adc_; // default, input: A0 00016 DacDual dacAB_; // object of DacDual class 00017 Ticker timer_; // for timer interrupt 00018 00019 // Called every 0.1 ms 00020 void TimerIsr() 00021 { 00022 float value = adc_.Read(); // AD 00023 00024 // pin14 : Inphase 00025 // pin10 : Out-of-phase 00026 dacAB_.Write(value, -value); 00027 } 00028 00029 int main() 00030 { 00031 timer_.attach_us(&TimerIsr, 1.0e6f/FS_); 00032 00033 while (true) {} // infinite loop 00034 }
Generated on Sat Jul 16 2022 15:47:29 by
1.7.2
