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.
main.cpp
00001 //-------------------------------------------------------------- 00002 // FIR フィルタ,転置形 00003 // Analog Input : A0 00004 // Analog Output: MCP4922 using SPI 00005 // 2014/11/12, Copyright (c) 2014 MIKAMI, Naoki 00006 //-------------------------------------------------------------- 00007 00008 #include "mbed.h" 00009 00010 #include "ADC_Base.hpp" // for ADC not using interrupt 00011 #include "DAC_MCP4922.hpp" // for DAC MCP4922 00012 #include "Coefficients_200_LPF.hpp" 00013 00014 using namespace Mikami; 00015 00016 const int FS_ = 12000; // Sampling frequency: 12 kHz 00017 ADC_Base adc_(A0, FS_); // for AD 00018 DAC_MCP4922 myDac_; // for DA 00019 00020 int main() 00021 { 00022 myDac_.ScfClockTim3(500000); // cutoff frequency: 5 kHz 00023 00024 float un[ORDER_+1]; 00025 for (int n=0; n<=ORDER_; n++) 00026 un[n] = 0; 00027 00028 while (true) 00029 { 00030 float xn = adc_.Read(); // Read from A0 00031 //----------------------------------------------- 00032 00033 for (int k=0; k<ORDER_; k++) 00034 un[k] = hm_[k]*xn + un[k+1]; 00035 un[ORDER_] = hm_[ORDER_]*xn; 00036 00037 //----------------------------------------------- 00038 myDac_.Write(un[0]); // Write to DAC 00039 } 00040 }
Generated on Wed Jul 20 2022 09:10:42 by
