Presentation on theme: "4-Integrating Peripherals in Embedded Systems (cont.)"— Presentation transcript:
1 4-Integrating Peripherals in Embedded Systems (cont.)
2 Analog-to-digital converters Why Analog?Not everything is digital!Even digital signaling has analog aspects (!?)Analog circuits and analysis are still necessaryPhysical phenomena (i.e., the real world) are usually analogMany sensors are analog (potentiometer, phototransistor, thermo-sensor, microphone)Many actuators are analog (solenoid, speakers)Some signals need to be processed in analog domain before conversion to digital (amplification, filtering, linearization)
3 Analog-to-digital converters proportionalityVmax = 7.5V0V11111110000000100100011010001010110000010011010101111001101111010.5V1.0V1.5V2.0V2.5V3.0V3.5V4.0V4.5V5.0V5.5V6.0V6.5V7.0Vanalog to digital4321t1t2t3t40100100001100101timeanalog input (V)Digital outputdigital to analog43210100100001100101t1t2t3t4timeanalog output (V)Digital input
4 Analog to Digital Conversion Instantaneous amplitudes of continuous analog signal, measured at equally spaced points in time.A series of “snapshots”Error=1/2 LSB
5 Analog to Digital Overview Sampling RateHow often analog signal is measured[samples per second, Hz]Example: 44,100 HzSampling Resolution[a.k.a. “sample word length,” “bit depth”] Precision of numbers used for measurement: the more bits, the higher the resolution.Example: 16 bit
6 Sampling RateDetermines the highest frequency that you can represent with a digital signal.Nyquist Theorem:Sampling rate must be at least twice as high as the highest frequency you want to represent.Capturing just the crest and trough of a sine wave will represent the wave exactly.
7 Digital and Analog Conversion A/D transfer function:10-bit ADC converter1024 voltage levels between 0V and VREF10-bit digital valueUsually VDD=VREF(e-Vmin)/(Vmax-Vmin)=d/(2^n-1),When Vmin=0:e/Vmax=D/(2^n-1)In generalVmax match 2^n-1Vmin match 0How does D/A and A/D conversion work?
8 D/A Conversion D/A is simpler than A/D Different resisters and an inverted OpAmp, to implement a weighted summer.Example: 4-bit D/AIf D3D2D1D0=0001 (i.e., 0V,0V,0V,-5V)Vo=-1.1*(D0/17.6+D1/8.8+D2/4.4+D2/2.2)=0.3125VIf D3D2D1D0=1111 (i.e., -5V,-5V,-5V,-5V)=4.6875V
9 A/D ConversionUse D/A converter to generate different analog values and compareControl logic decides which values to tryWhen comparison complete, best match is put on outputHow can D/A be matched to input in fewest steps?
10 Successive Approximation (SAR) ADC Matching strategies:Counting conversion (slow)Successive approximation (faster)Successive Approximation:Basically binary search:Exact 10 steps instead of 1024, SAR is fast!
11 Digital-to-analog conversion using successive approximation Given an analog input signal whose voltage should range from 0 to 15 volts, and an 8-bit digital encoding, calculate the correct encoding for 5 volts. Then trace the successive-approximation approach to find the correct encoding.5/15 = d/(28 - 1)=d/255d= 85Encoding:Successive-approximation method½(Vmax + Vmin) = 7.5 voltsVmax = 7.5 volts.½( ) = 5.16 voltsVmax = 5.16 volts.1½( ) = 3.75 voltsVmin = 3.75 volts.1½( ) = 4.93 voltsVmin = 4.93 volts.1½( ) = 5.63 voltsVmax = 5.63 volts1½( ) = 5.05 voltsVmax = 5.05 volts.1½( ) = 4.69 voltsVmin = 4.69 volts.1½( ) = 4.99 volts1
12 Analog to Digital Recording Chain ADCMicrophone converts acoustic to electrical energy. It’s a transducer.Continuously varying electrical energy is an analog of the sound pressure wave.ADC (Analog to Digital Converter) converts analog to digital electrical signal.Digital signal transmits binary numbers.DAC (Digital to Analog Converter) converts digital signal in computer to analog for your headphones.
13 Analog Representations of Sound Magnified phonograph grooves, viewed from above:When viewed from the side, channel 1 goes up and down, and channel 2 goes side to side.
14 Common Sampling RatesWhich rates can represent the range of frequencies audible by (fresh) ears?Sampling RateUses44.1 kHz (44100)CD, DAT48 kHz (48000)DAT, DV, DVD-Video96 kHz (96000)DVD-Audio22.05 kHz (22050)Old samplersMost software can handle all these rates.
15 Time — measure amp. at each tick of sample clock 3-bit QuantizationA 3-bit binary (base 2) number has 23 = 8 values.1234567AmplitudeTime — measure amp. at each tick of sample clockA rough approximation
16 Common Sampling Resolutions Word lengthUses8-bit integerLow-res web audio16-bit integerCD, DAT, DV, sound files24-bit integerDVD-Video, DVD-Audio32-bit floating pointSoftware (usually only for internal representation)
17 The Digital Audio Stream It’s just a series of sample numbers, to be interpreted as instantaneous amplitudes: one for every tick of the sample clock.Previous example:This is what appears in a sound file, along with a header that indicates the sampling rate, bit depth and other things.
18 Audio File Size CD Stereo characteristics: - Sampling rate:44,100 samples per second (44.1 kHz)- Sample word length:16 bits (i.e., 2 bytes) per sample- Number of channels:2 (stereo)How big is a 5-minute CD-quality sound file?
19 Audio File Size How big is a 5-minute CD-quality sound file? 44,100 samples * 2 bytes per sample * 2 channels= 176,400 bytes per secondor =1.41 M bits per secondNote for DVD audio:48,000 samples instead of 44,100 = MbpsCD 5 minutes * 60 seconds per minute= 300 seconds300 seconds * 176,400 bytes per second= 52,920,000 bytes = c megabytes (MB)
20 MPEG Compression #: The 384 is 1/4th of the 1.536 Mbps Data Reduction LayerBitrate (kbps) for stereo1:41384#1:6..1:821:10..123128…112MPEG 1-Layer 3 (.mp3)“Motion Picture Experts Group”Different levels for different purposesE.g. MPEG 2 used for DVDsTakes out parts of the sound signal that humans can’t hearHow does the size change?Lossy compression#: The 384 is 1/4th of the MbpsMore on MPEG Compression