by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp
00001 /* Program Example 11.1 DSP input and Output 00002 */ 00003 #include "mbed.h" 00004 //mbed objects 00005 AnalogIn Ain(p15); 00006 AnalogOut Aout(p18); 00007 Ticker s20khz_tick; 00008 00009 //function prototypes 00010 void s20khz_task(void); 00011 //variables and data 00012 float data_in, data_out; 00013 00014 //main program start here 00015 int main() { 00016 s20khz_tick.attach_us(&s20khz_task,50); //attach task to 50us tick 00017 } 00018 00019 // function 20khz_task 00020 void s20khz_task(void){ 00021 data_in=Ain; 00022 data_out=data_in; 00023 Aout=data_out; 00024 } 00025
Generated on Sat Jul 16 2022 21:39:03 by 1.7.2