Juan Angel García
/
11_1
DSP simple
Diff: main.cpp
- Revision:
- 0:43c022a9dd55
diff -r 000000000000 -r 43c022a9dd55 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 09 21:52:42 2017 +0000 @@ -0,0 +1,30 @@ +/* Program Example 11.1 DSP input and Output +*/ +#include "mbed.h" +//mbed objects + +AnalogIn Ain(p15); + +AnalogOut Aout(p18); + +Ticker s20khz_tick; + +//function prototypes +void s20khz_task(void); + +//variables and data +float data_in, data_out; + +//main program start here +int main() +{ + s20khz_tick.attach_us(&s20khz_task,50); // attach task to 50us tick (20khz) +} + +// function 20khz_task. Para realizar un muestreo a intervalos de 50us +void s20khz_task(void) +{ + data_in=Ain; + data_out=data_in; + Aout=data_out; +} \ No newline at end of file