Chapter 13: Digital to Analog Conversion and Sound
Embedded
Systems - Shape The World
Jonathan Valvano and Ramesh Yerraballi
As part of the edX online class, we made some interactive web pages to illustrate fundamental concepts
2. Fundamental Concepts | Number conversions |
5. Introduction to C | Flowcharts, C vs assembly |
6. Microcontroller Ports | Input/output, direction register |
7. Design and Development | Successive refinement, if-then, loops |
10. Finite State Machines | Vending machine and stepper motor |
11. UART Serial Interface | Blind, busy-wait, interrupt, serial port |
12. Interrupts | Mail box, context switch |
13. DAC and Sound | Sampling rate, precision, how a DAC works |
14. ADC and Data Acquisition | How an ADC works, Nyquist Theorem |
Discover the Nyquist Theorem. A Continuous waveform like Figure 13.1 is shown, V = 1.5 + 1*sin(2pi50t)+0.5*cos(2pi 200t). You may select the sampling rate and the precision (in bits) to see the signal captured. Notice that at sampling rates above 100 Hz you capture the essence of the 50Hz periodic wave, and above 400 Hz you capture the essence of both the 50 and 200 Hz waves. To “capture the essence” means the analog and digital signal go up and down at the same rate.
Learn about DAC precision using this tool. The analog output is fixed in the range 0 to 3.3V. You may adjust the number of bits from 1 to 10 to see how close the fit is to the straight line.
1 10 Number of DAC bits = 0
Shows how to compute Vout for the two scenarios bit1=0;bit0=1 and bit1=1;bit0=0. Using superposition, the scenario bit1=1;bit0=1 is simply the sum of the two cases: bit1=0;bit0=1 and bit1=1;bit0=0.
bit 0: bit 1:
Reprinted with approval from Embedded Systems: Introduction to ARM Cortex-M Microcontrollers, 2016, ISBN: 978-1477508992, http://users.ece.utexas.edu/~valvano/arm/outline1.htm
and from Embedded Systems: Real-Time Interfacing to ARM® Cortex™-M Microcontrollers, 2016, ISBN: 978-1463590154, http://users.ece.utexas.edu/~valvano/arm/outline.htm