Rob Toulson / Mbed 2 deprecated PE_05-05_DataConversion

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
robt
Date:
Mon Oct 15 21:21:42 2012 +0000
Commit message:
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 15 21:21:42 2012 +0000
@@ -0,0 +1,25 @@
+/*Program Example 5.5: Inputs signal through ADC, and outputs to DAC. 
+View DAC output on oscilloscope. To demonstrate Nyquist, connect variable 
+frequency signal generator to ADC input. Allows measurement of conversion 
+times, and explores Nyquist limit.
+                                                                            */
+#include "mbed.h"
+AnalogOut Aout(p18);      //defines analog output on Pin 18
+AnalogIn Ain(p20);        //defines analog input on Pin 20
+DigitalOut test(p5);
+float ADCdata;
+
+int main() {
+  while(1) {
+    ADCdata=Ain;   //starts A-D conversion, and assigns analog value to ADCdata
+    test=1;        //switch test output, as time marker
+    test=0;
+    Aout=ADCdata;  // transfers stored value to DAC, and forces a D-A conversion 
+    test=1;        //a double pulse, to mark the end of conversion 
+    test=0;     
+    test=1;
+    test=0;             
+    //wait(0.001);    //optional wait state, to explore different cycle times
+   }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 15 21:21:42 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc
\ No newline at end of file