CS 1103 What Is Digital Part 2 Prof

  • Slides: 36
Download presentation
CS 1103 電機資訊 程實習 What Is Digital? (Part 2) Prof. Chung-Ta King Department of

CS 1103 電機資訊 程實習 What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University (Contents from MIT EECS 6. 01/6. 02, Wikipedia, U. of Indiana K 361, www. arrl. org, www. sounderpro. com. tw/Digital)

Outline u Continuous versus discrete l l u Building digital devices l u u

Outline u Continuous versus discrete l l u Building digital devices l u u Problems with “continuous” Going into discrete/digital IC to digital logic to computing devices Transforming analog inputs into digital Transforming digital to analog outputs 2

我們實際上是運用了Sampling的技巧 u Digital representations of analog waveforms Continuous time Continuous values Discrete time Discrete

我們實際上是運用了Sampling的技巧 u Digital representations of analog waveforms Continuous time Continuous values Discrete time Discrete values 4

Sampling u The value of the analog signal is measured at certain intervals in

Sampling u The value of the analog signal is measured at certain intervals in time. Each measurement is referred to as a sample. A series of “snapshots” 5

Sampling in Space 6

Sampling in Space 6

Terminologies in Sampling u Sampling rate: l u How often analog signal is measured

Terminologies in Sampling u Sampling rate: l u How often analog signal is measured [samples per second, Hz], e. g. 44, 100 Hz Sampling resolution: l Number of bits to represent each sample [“sample word length, ” “bit depth”], e. g. 16 bit Analog Input 4 Samples/cycle 8 Samples/cycle 16 Samples/cycle 7

Problem with Sampling u The analog signal is sampled at discrete intervals of time

Problem with Sampling u The analog signal is sampled at discrete intervals of time l l The digital output is an incomplete picture of the behavior of the input There is no way of knowing, by looking at the output, what the input was doing between one sampling instant and the next 9

How Many Samples Are Enough? u Reconstruction: Is it possible to reconstruct the original

How Many Samples Are Enough? u Reconstruction: Is it possible to reconstruct the original waveform using only the discrete time samples? 10

Shannon-Nyquist Sampling Theorem u How many samples are necessary to preserve the information contained

Shannon-Nyquist Sampling Theorem u How many samples are necessary to preserve the information contained in the signal? l l If signal contains high frequency components, need to sample at even higher rate to avoid losing information in the signal How much faster? Sampling Theorem: A signal can be exactly reproduced if it is sampled at a frequency that is greater than twice max. frequency in the signal http: //www 2. egr. uh. edu/~glover/applets/Sampling. html 11

Sampling at Same Frequency 12

Sampling at Same Frequency 12

Sampling at Twice Frequency 13

Sampling at Twice Frequency 13

Aliasing u If sampling rate not high enough l l New frequencies appear in

Aliasing u If sampling rate not high enough l l New frequencies appear in reconstructed signals Need circuits to eliminate (anti-aliasing filter) A high frequency signal sampled at a lower rate looks like … … a lower frequency signal 15

Encoding of Discrete Signals u If we use N bits to encode the magnitude

Encoding of Discrete Signals u If we use N bits to encode the magnitude of one of the discrete-time samples, we can capture 2 N possible values 16

3 -bit Quantization u A 3 -bit binary number has 23 = 8 values

3 -bit Quantization u A 3 -bit binary number has 23 = 8 values 7 Amplitude 6 5 4 3 2 1 0 Time — measure amplitude at each tick of sample clock 17

4 -bit Quantization A 4 -bit binary number has 24 = 16 values u

4 -bit Quantization A 4 -bit binary number has 24 = 16 values u 14 12 Amplitude 10 8 6 4 2 0 Time — measure amplitude at each tick of sample clock 18

The Digital Audio Stream A series of sample numbers, to be interpreted as instantaneous

The Digital Audio Stream A series of sample numbers, to be interpreted as instantaneous amplitudes, one for every tick of the sample clock. l This is what appears in a sound file, along with a header that indicates the sampling rate, bit depth and other things. 11 13 15 13 10 9 6 1 4 9 15 11 13 9 14 12 10 Amplitu de u 8 6 4 2 0 19

Audio File Size CD characteristics… u Sampling rate: l u Sample word length: l

Audio File Size CD characteristics… u Sampling rate: l u Sample word length: l u 16 bits (i. e. , 2 bytes) per sample Number of channels: l u 44, 100 samples per second (44. 1 k. Hz) 2 (stereo) How big is a 5 -minute CD-quality sound file? 20

Quantization Error u When we quantize the scaled sample values, we may be off

Quantization Error u When we quantize the scaled sample values, we may be off by up to ± 1/2 step from the true sampled values l Round-off error: difference between actual signal and quantization to integer values… Random errors: sounds like low-amplitude noise 21

Sampling Rate and Encoding Bits 22

Sampling Rate and Encoding Bits 22

Resolution Trade-offs Bit Resolution Sample Rate High Bit Count Good Duplication Slow Low Bit

Resolution Trade-offs Bit Resolution Sample Rate High Bit Count Good Duplication Slow Low Bit Count Poor Duplication Fast High Sample Rate Good Duplication Slow Low Sample Rate Poor Duplication Fast 23

Analog to Digital Recording Chain ADC Microphone converts acoustic to electrical energy. It’s a

Analog to Digital Recording Chain ADC Microphone 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. 24

ADC and DAC http: //www. dspguide. com/ch 3/4. htm 25

ADC and DAC http: //www. dspguide. com/ch 3/4. htm 25

ADC in Digital Camera http: //www. tasi. ac. uk/advice/creating/camera. html 26

ADC in Digital Camera http: //www. tasi. ac. uk/advice/creating/camera. html 26

Converting Analog into Digital u The simplest form of ADC uses a resistance ladder

Converting Analog into Digital u The simplest form of ADC uses a resistance ladder to switch in the appropriate number of resistors in series to create the desired voltage that is compared to the input (unknown) voltage 27

Converting Analog into Digital u u The resistance ladder changes its configuration systematically and

Converting Analog into Digital u u The resistance ladder changes its configuration systematically and the output voltage is compared to the analog voltage in a comparator When there is a match, the digital equivalent (switch configuration) is captured 28

How? Binary Search u Initial conditions l l u Expected high 5 volts Expected

How? Binary Search u Initial conditions l l u Expected high 5 volts Expected low 0 volts 5 volts 256 0 volts 0 Voltage to be converted l l Analog 5 -volts 3. 42 -volts 2. 5 -volts Digital 256 Unknown (175) 128 3. 42 volts Equates to 175 0 -volts 0 29

無線感測平台 The World Smallest Wireless Sensing Platform, Eco Node 33

無線感測平台 The World Smallest Wireless Sensing Platform, Eco Node 33

Summary u Digitization of analog signals by sampling l l Sampling rate and resolution

Summary u Digitization of analog signals by sampling l l Sampling rate and resolution Problems with sampling: aliasing, quantization errors u Analog to digital conversion u Analysis of digital signals: FFT 36