* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 1: Primitive Java
Index of electronics articles wikipedia , lookup
Oscilloscope history wikipedia , lookup
Schmitt trigger wikipedia , lookup
Integrating ADC wikipedia , lookup
Loudspeaker wikipedia , lookup
Phase-locked loop wikipedia , lookup
Audio power wikipedia , lookup
Immunity-aware programming wikipedia , lookup
Analog-to-digital converter wikipedia , lookup
Microcontroller wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Transistor–transistor logic wikipedia , lookup
Valve RF amplifier wikipedia , lookup
Current mirror wikipedia , lookup
Valve audio amplifier technical specification wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Wien bridge oscillator wikipedia , lookup
Power electronics wikipedia , lookup
Radio transmitter design wikipedia , lookup
Opto-isolator wikipedia , lookup
EE 319K Introduction to Microcontrollers Lecture 11: DAC, Sound on 9S12, Lab7(Music/Pacemaker) 11-1 Digital to Analog Conversion Examples Signal generation (sound, image, touch…) Output to affect external devices (power, flow, heat…) The DAC precision is the number of distinguishable DAC outputs (e.g., 16 alternatives, 4 bits). The DAC range is the maximum and minimum DAC output (0 to 5V). The DAC resolution is the smallest distinguishable change in output. (5V/16 =0.31V) Range(volts) = Precision(alternatives) * Resolution(volts) The DAC accuracy is (Actual - Ideal) / Ideal Ramesh Yerraballi 11-2 2-bit DAC - Two Designs N 0 1 2 3 Q1 0 0 5 5 Q0 0 5 0 5 V1(V) 0.00 1.25 2.50 3.75 V2(V) 0.00 1.67 3.33 5.00 10k Q1 Q0 20k 10k V1 20k Q1 Q0 20k V2 *Assume VOH of the 9S12 is 5V and VOL is 0V Ramesh Yerraballi 11-3 4-bit DAC N 0 1 2 8 15 Q3 0 0 0 5 5 Q2 0 0 0 0 5 Q1 Q0 0 0 0 5 5 0 0 0 5 5 theory 5*0/15 5*1/15 5*2/15 5*8/15 5*15/15 Vout (V) 0.00 0.33 0.67 2.67 5.00 Vout = (8*Q3 + 4*Q2 + 2*Q1 + Q0)/15 where Qn is 5V or 0V static testing 6812 6812 bit3 bit2 Ramesh Yerraballi dynamic testing bit3 Vout bit2 voltmeter bit1 bit1 bit0 bit0 I out speaker 11-4 Sound Basics Humans can hear from about 25 to 20,000 Hz. Middle A is 440 Hz Other notes on a keyboard are determined 440 * 2N/12 "N" is number of notes up or down from middle A. Middle C is 261.6 Hz. Music contains multiple harmonics Ramesh Yerraballi 11-5 Sound period pitch = 1/period loudness The loudness and pitch are controlled by the amplitude and frequency. A 440Hz sine wave generated with a 4-bit DAC. The plot on the right is the Fourier Transform(frequency spectrum dB versus kHz) of the data plotted on the left. Ramesh Yerraballi 11-6 Music period A waveform shape that generates a trumpet sound. Ramesh Yerraballi 11-7 …Music 330 Hz 0.5s 330 Hz 0.5s 523 Hz 1.0s You can control the amplitude, frequency and duration of each note (not drawn to scale). 330 Hz 0.5s 330 Hz 0.5s 523 Hz 1.0s The amplitude of a plucked string drops exponentially in time Ramesh Yerraballi 11-8 …Music Sound Amplitude 2 1 0 -1 -2 0 0.005 0.01 Time (sec) 0.015 0.02 A simple chord mixing the notes C and G Ramesh Yerraballi 11-9 Song How much memory does it take to store a song? 3 minutes Stereo Channels 44 kHz 12-bit per channel How many bus cycles does it take to output one value? Fetch data from memory Decompress Filter/amplify/mix/envelope DAC speed Ramesh Yerraballi 11-10 Lab7: Sound Debugging: Use a DC motor to test the voltages being output to the analog out Connect the PH3-0 lines to power a DC motor Connect a scope to view this voltage as a function of time Once you are sure your DAC_Out is doing what it is supposed to, then go ahead and implement the piano keys Ramesh Yerraballi 11-11 Sine Wave with period T Periodic Interrupt every T/32 Output next entry in below table on interrupt fcb fcb fcb 8,9,11,12,13,14,14,15,15,15,14 14,13,12,11,9,8,7,5,4,3,2 2,1,1,1,2,2,3,4,5,7 4-bit DAC output SinTab 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 4-bit sin table 0 1 2 3 4 5 6 7 theta (radians) Ramesh Yerraballi 11-12 Lab7: Pacemaker Debugging: Use a DC motor to test the voltages being output to the analog out Connect the PH3-0 lines to power a DC motor Connect a scope to view this voltage as a function of time Once you are sure your DAC_Out is doing what it is supposed to, then go ahead and implement a DAC circuit Ramesh Yerraballi 11-13 Ventricular Output pulse Ae-t/τ (Amplitude A=5; τ=2) Periodic Interrupt every t2/101 Output next entry in below table on interrupt VentOut fcb fcb fcb fcb fcb fcb fcb fcb fcb fcb 15,15,15,15,14,14,14,14,14,14 14,13,13,13,13,13,13,13,13,12 12,12,12,12,12,12,12,11,11,11 11,11,11,11,11,11,10,10,10,10 10,10,10,10,10,10,9,9,9,9 9,9,9,9,9,9,9,8,8,8 8,8,8,8,8,8,8,8,8,8 7,7,7,7,7,7,7,7,7,7 7,7,7,7,6,6,6,6,6,6 6,6,6,6,6,6,6,6,6,6,6 16 14 12 10 8 "Orig" 6 Approx 4 2 0 0.12 0.24 0.36 0.48 0.6 0.72 0.84 0.96 1.08 1.2 1.32 1.44 1.56 1.68 1.8 1.92 0 Ramesh Yerraballi 11-14