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 // #################### DAC F302 #################### 00003 00004 #include "mbed.h" 00005 00006 AnalogIn Ain(A0); // Entrada sinal de áudio 00007 00008 AnalogOut Aout(A2); // Reconstrução -sinal de áudio 00009 00010 Ticker snyq_tick; 00011 00012 00013 void snyq_task(void); 00014 00015 00016 float data_in, data_out; 00017 00018 int main() 00019 { 00020 snyq_tick.attach_us(&snyq_task,25); // tempo de amostragem do sinal 1/25us 00021 } 00022 // Funcção Amostragem do Sinal - DAC 00023 void snyq_task(void) 00024 { 00025 data_in=Ain; 00026 data_out=data_in; 00027 Aout=data_out; 00028 00029 } 00030 00031 //float LPF(float LPF_in) 00032 //{ 00033 //float a[4]= {1,2,1}; 00034 00035 //float b[4]= {1,2,1}; 00036 //static float LPF_out; 00037 //static float x[4], y[4]; 00038 //x[3] = x[2]; 00039 //x[2] = x[1]; 00040 //x[1] = x[0]; // move x values by one sample 00041 //y[3] = y[2]; 00042 //y[2] = y[1]; 00043 //y[1] = y[0]; // move y values by one sample 00044 // x[0] = LPF_in; // new value for x[0] 00045 // y[0] = (b[0]*x[0]) + (b[1]*x[1]) + (b[2]*x[2]) + (b[3]*x[3]) + (a[1]*y[1]) + (a[2]*y[2]) + (a[3]*y[3]); 00046 00047 //LPF_out = y[0]; 00048 //return LPF_out; // output filtered value 00049 //}
Generated on Wed Jul 20 2022 19:14:01 by
1.7.2