Experiment 2: Sampling and Quantization

Similar documents
Experiment # 5. Pulse Code Modulation

Digital Signal Processing Laboratory 7: IIR Notch Filters Using the TMS320C6711

ECE438 - Laboratory 4: Sampling and Reconstruction of Continuous-Time Signals

Digital Signal. Continuous. Continuous. amplitude. amplitude. Discrete-time Signal. Analog Signal. Discrete. Continuous. time. time.

Lab 1 Introduction to the Software Development Environment and Signal Sampling

Signals and Systems. Spring Room 324, Geology Palace, ,

FFT Laboratory Experiments for the HP Series Oscilloscopes and HP 54657A/54658A Measurement Storage Modules

Module 8 : Numerical Relaying I : Fundamentals

Multirate Digital Signal Processing

MIE 402: WORKSHOP ON DATA ACQUISITION AND SIGNAL PROCESSING Spring 2003

Lab experience 1: Introduction to LabView

Journal of Theoretical and Applied Information Technology 20 th July Vol. 65 No JATIT & LLS. All rights reserved.

ELEC 310 Digital Signal Processing

Introduction to Digital Signal Processing (Discrete-time Signal Processing) Prof. Ja-Ling Wu Dept. CSIE & GINM National Taiwan University

Experiment # 4 Counters and Logic Analyzer

DSP First Lab 04: Synthesis of Sinusoidal Signals - Music Synthesis

Fundamentals of DSP Chap. 1: Introduction

Introduction to Digital Signal Processing (DSP)

Digital Signal Processing (DSP)

Lab 2: A/D, D/A, and Sampling Theorem

LabView Exercises: Part II

Digital Effects Pedal Description Ross Jongeward 10 December 2014

Data Converter Overview: DACs and ADCs. Dr. Paul Hasler and Dr. Philip Allen

Lab P-6: Synthesis of Sinusoidal Signals A Music Illusion. A k cos.! k t C k / (1)

1 Overview. 1.1 Digital Images GEORGIA INSTITUTE OF TECHNOLOGY. ECE 2026 Summer 2016 Lab #6: Sampling: A/D and D/A & Aliasing

Design and VLSI Implementation of Oversampling Sigma Delta Digital to Analog Convertor Used For Hearing Aid Application

Digital Fundamentals. Introduction to Digital Signal Processing

1 Overview. 1.1 Digital Images GEORGIA INSTITUTE OF TECHNOLOGY. ECE 2026 Summer 2018 Lab #5: Sampling: A/D and D/A & Aliasing

Course Web site:

Laboratory 5: DSP - Digital Signal Processing

NanoGiant Oscilloscope/Function-Generator Program. Getting Started

Experiment 9 Analog/Digital Conversion

Laboratory Assignment 3. Digital Music Synthesis: Beethoven s Fifth Symphony Using MATLAB

-SQA-SCOTTISH QUALIFICATIONS AUTHORITY HIGHER NATIONAL UNIT SPECIFICATION GENERAL INFORMATION

Lab 5 Linear Predictive Coding

Voice Controlled Car System

Introduction to Signal Processing D R. T A R E K T U T U N J I P H I L A D E L P H I A U N I V E R S I T Y

Digital Signal Processing Lecture One Introduction to Digital Signal Processing Third Stage Prepared by: Marwah Kareem

Department of Communication Engineering Digital Communication Systems Lab CME 313-Lab

Crash Course in Digital Signal Processing

PCM ENCODING PREPARATION... 2 PCM the PCM ENCODER module... 4

AN INTEGRATED MATLAB SUITE FOR INTRODUCTORY DSP EDUCATION. Richard Radke and Sanjeev Kulkarni

Interfacing Analog to Digital Data Converters. A/D D/A Converter 1

Lesson 2.2: Digitizing and Packetizing Voice. Optimizing Converged Cisco Networks (ONT) Module 2: Cisco VoIP Implementations

Figure 1: Feature Vector Sequence Generator block diagram.

OCTAVE C 3 D 3 E 3 F 3 G 3 A 3 B 3 C 4 D 4 E 4 F 4 G 4 A 4 B 4 C 5 D 5 E 5 F 5 G 5 A 5 B 5. Middle-C A-440

ECE 5765 Modern Communication Fall 2005, UMD Experiment 10: PRBS Messages, Eye Patterns & Noise Simulation using PRBS

Spectrum Analyser Basics

ECE 2274 Pre-Lab for Experiment Timer Chip

Digital Logic. ECE 206, Fall 2001: Lab 1. Learning Objectives. The Logic Simulator

1.1 Digital Signal Processing Hands-on Lab Courses

Towards More Efficient DSP Implementations: An Analysis into the Sources of Error in DSP Design

Introduction To LabVIEW and the DSP Board

Reconfigurable FPGA Implementation of FIR Filter using Modified DA Method

Professor Laurence S. Dooley. School of Computing and Communications Milton Keynes, UK

ME EN 363 ELEMENTARY INSTRUMENTATION Lab: Basic Lab Instruments and Data Acquisition

International Journal of Engineering Research-Online A Peer Reviewed International Journal

Lab #6: Combinational Circuits Design

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR NPTEL ONLINE CERTIFICATION COURSE. On Industrial Automation and Control

ON THE INTERPOLATION OF ULTRASONIC GUIDED WAVE SIGNALS

Converters: Analogue to Digital

Techniques for Extending Real-Time Oscilloscope Bandwidth

Rapid prototyping of of DSP algorithms. real-time. Mattias Arlbrant. Grupphandledare, ANC

Memory efficient Distributed architecture LUT Design using Unified Architecture

Getting Started with the LabVIEW Sound and Vibration Toolkit

S I N E V I B E S FRACTION AUDIO SLICING WORKSTATION

Analog to Digital Conversion

Keywords Xilinx ISE, LUT, FIR System, SDR, Spectrum- Sensing, FPGA, Memory- optimization, A-OMS LUT.

SREV1 Sampling Guide. An Introduction to Impulse-response Sampling with the SREV1 Sampling Reverberator

Analyzing and Saving a Signal

Chapter 2 Signals. 2.1 Signals in the Wild One-Dimensional Continuous Time Signals

Introduction to the oscilloscope and digital data acquisition

Investigation of Digital Signal Processing of High-speed DACs Signals for Settling Time Testing

Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017

Problem Set #1 Problem Set Due: Friday, April 12

Multirate Signal Processing: Graphical Representation & Comparison of Decimation & Interpolation Identities using MATLAB

Session 1 Introduction to Data Acquisition and Real-Time Control

Sampling. Sampling. CS 450: Introduction to Digital Signal and Image Processing. Bryan Morse BYU Computer Science

ECE 4220 Real Time Embedded Systems Final Project Spectrum Analyzer

Design and Implementation of Partial Reconfigurable Fir Filter Using Distributed Arithmetic Architecture

DHANALAKSHMI COLLEGE OF ENGINEERING Tambaram, Chennai

Muscle Sensor KI 2 Instructions

SCIENCE & TECHNOLOGY

with - < n < +. There are two types of approximations associated with the sampling process. finite precision of the ADC finite sampling frequency.

Experiment 13 Sampling and reconstruction

Performance Analysis and Behaviour of Cascaded Integrator Comb Filters

Chapter 1. Introduction to Digital Signal Processing

Calibrate, Characterize and Emulate Systems Using RFXpress in AWG Series

NON-UNIFORM KERNEL SAMPLING IN AUDIO SIGNAL RESAMPLER

Audio Signal Processing Studio Remote Lab for Signals and Systems Class

Digitization: Sampling & Quantization

High Performance Real-Time Software Asynchronous Sample Rate Converter Kernel

Virtual instruments and introduction to LabView

Exercise 2: D-Type Flip-Flop

The following exercises illustrate the execution of collaborative simulations in J-DSP. The exercises namely a

Embedded Signal Processing with the Micro Signal Architecture

Introduction to Data Conversion and Processing

ni.com Digital Signal Processing for Every Application

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

B I O E N / Biological Signals & Data Acquisition

Transcription:

ECE431, Experiment 2, 2016 Communications Lab, University of Toronto Experiment 2: Sampling and Quantization Bruno Korst - bkf@comm.utoronto.ca Abstract In this experiment, you will see the effects caused by changes in sampling time and quantization levels on a digitized (i.e., sampled) sinusoidal signal. You will start by designing and testing a system to produce an output delayed half of a sample relative to the input. On the second part of the experiment, you will move on to changing the number of bits assigned to each sample of the input signal, and will observe the presence of quantization noise. Keywords sampling half-sample delay quantization levels quantization noise Contents Introduction 1 1 Experiment 2 1.1 Half-Sample Delay................................................................. 2 Problem Statement Simulation - PreLab Questions Implementation 1.2 Quantization..................................................................... 3 2 Accomplishments 4 Acknowledgments 4 References 4 Introduction In order to manipulate an analog signal using a microprocessor, the signal must be converted into a digital form. The purpose of this experiment is to introduce sampling and quantization. It is fair to say that every textbook on Digital Signal Processing (DSP) starts by describing how an analog signal is converted into a digital signal prior to being processed [1], [2]. A/D conversion (analog-to-digital, or simply a to d ) is the very first step to be performed, usually by a hardware device called an A/D (analog-to-digital, or simply a to d ) converter. The A/D converter will take samples of the signal at regular intervals (a process called sampling) and will assign binary quantities to these samples (a process called quantization). After the signal is processed by the microprocessor, the resulting digital samples are sent to a D/A converter to be recomposed into an analog (continuous) signal. The hardware you will use in this lab includes an integrated circuit that does both A/D and D/A conversions (a CODEC), and a dedicated signal processor (a DSP ) that performs all necessary computation as specified in the program you will run. The CODEC operates at 48KHz sampling rate, with each two-channel sample represented in 32 bits (that is, 16 bits per channel). Keep these numbers in mind throughout the lab. In this experiment, you will play with the sample time and the number of quantization bits. It is a good idea if you review your notes on convolution, half-sample delay from introduction to signals and systems, and bitwise operations from microprocessor theory. The experiment will be done in two main parts: First, you will create a half sample delay by means of a convolution between the input analog signal and an impulse response sequence that you will calculate. Second, you will observe the effects of reducing the number of bits used per sample. As this number decreases, noise increases and the resulting signal is a deteriorated version of the original analog signal.

Experiment 2: Sampling and Quantization 2/5 Note that the lab answer sheet is to be done in groups of two students. Before you come to the lab, complete the Preparation document. You should also print the answer sheet to bring to the lab. Note that there are a few questions marked PreLab on the answer sheet. You are expected to fill those out prior to the experiment. You will need the results of that portion for the experiment. In the lab, then, you will follow the procedure below on the computer and record your answers for the remaining questions on the answer sheet. 1. Experiment 1.1 Half-Sample Delay In a previous course on signals and systems, you would have been introduced to convolution. In this part of the lab you will design a sequence and convolve it with a sinusoid. While in MATLAB you can design your sequences to have defined lengths, in a real-time implementation your incoming signal comes from a signal generator. For all purposes, the signal coming from the generator is infinite, for it lasts while the instrument is on. 1.1.1 Problem Statement Suppose that you have the sampled version of a continuous-time signal x(t) (which is bandlimited and is assumed to satisfy the Nyquist criterion) x[n] = x(nt s ), (1) where the sampling frequency is 48kHz. Your goal is to find y[n], the half-sample delayed version of x[n], i.e., y[n] = x((n 1/2)T s ). (2) Since x(t) satisfies Nyquist, you could in principle reconstruct x(t) from x[n], then resample to get y[n]. The point of this exercise is to find a digital way to accomplish the same thing. 1 In your lab preparation, design a digital filter with impulse response h[n] so that y[n] = x[n] h[n]. (3) Derive a mathematical expression for h[n], as follows. Consider the block diagram x(t T/2) x(t) x[n] x(t) y[n] C/D D/C e st/2 C/D h[n] The bandlimited signal x(t) is sampled to produce x[n]. By the sampling theorem, x(t) will be reconstructed by D/C. Delaying x(t) by T /2 seconds gives x(t T /2). Sampling this signal produces the desired y[n]. But the system in the block diagram from x[n] to y[n] is actually a discrete-time LTI system; let h[n] be its impulse response function. To find out what h[n] is, just set x[n] to be δ[n], the unit impulse, and find y[n]. Then h[n] must be equal to y[n] by definition of impulse response. The impulse response h[n] is of infinite length (IIR). In practical implementation, we need to limit it to a finite duration. For the rest of the lab, assume that the filter length is at most 32. 1.1.2 Simulation - PreLab Questions Your task now is to create: a) a finite sequence (i.e., a vector) of a sinusoid of frequency 2kHz, of length 100, sampled at 48kHz (to make it better to visualize, plot only 2 cycles of the sinusoid, or 48 samples); b) a 32 element sequence h 1 [n] to generate a delay of 17 samples; and c) a 32 element sequence h 2 [n] to generate a delay of 17-and-a-half samples (similar to the one you designed above). Plot h 1 [n] and h 2 [n] and attach to your answer booklet. You will determine that the half-sample delay is taking place by comparing the results of two convolutions: sinusoid convolved with 17-sample-delayed sequence; and sinusoid convolved with 17-and-half-sample-delayed sequence. Here is a hint: your designed sequences should look like the ones presented below. You may choose the same length as presented or not, but avoid going beyond a length of 35 samples. 1 The relevant material in the text is shown in the example for Noninteger Delay

Experiment 2: Sampling and Quantization 3/5 (a) Half Sample Figure 1. Two sequences to be convolved with the input (b) Pure Delay (shifted impulse) 1.1.3 Implementation The convolution that you just performed in MATLAB is the simulation of what you will do in real time. In order to run this convolution in real time, a skeleton program is given to you. Open Code Composer Studio - CCS - and click on the project named ECE431 Exp01a Half Sample Delay. After the project is selected as active (i.e., the name becomes bold-faced), click on it again to open the folder and see the files. You will need to insert your two sequences in the two coefficient files, written in C (look at the project tree on Code Composer Studio). Open the files, then copy and paste your sequences from within MATLAB. It may be a good idea to display the transpose of your sequence on the MATLAB active window and copy from there. After you do this, you will need to recompile the project and run the executable. This is done by clicking on the bug icon (a button with a green bug drawn on). Remember that the program deals with samples coming as one 32-bit word representing two channels (from a stereo CODEC). Two convolutions will be performed (one for each channel) and two outputs are generated. The outputs are combined into one word and sent back to the CODEC. With the DSP running already, turn on your oscilloscope and signal generator, and connect inputs and outputs appropriately. Make sure the output button on the signal generator is pressed or you will not have a signal. Set your signal to a 1.8 V pp (peak-to-peak) sine at 1KHz. Display both outputs on the scope. After you verify that it runs, modify the frequency to 20KHz, leaving the amplitude unchanged. Now move on to answer the questions on the answer sheet. When you are successful in observing the half-sample delay, ask the TA to sign off on your lab. Answer additional questions in the answer booklet. 1.2 Quantization This part of the experiment will be done without simulation. Stop the previous program and select now as active project the one named ECE431 Exp01b Quantization. After doing so, build it and run it. This program will leave the sampling rate untouched, but will allow you to modify the number of bits used to represent the incoming signal. The quatization done by the existing CODEC on the board provides 16 bits per sample, which means 2 16 quantization levels. That is a very good resolution for an audio signal, for instance. The hardware you use determines the word size in which samples are represented, and for this case it is two channels with 16 bits per sample each (i.e., it is a 32-bit CODEC). The experiment now is to limit the number of bits from the original 16-bit quantization, and observe the results on the oscilloscope. You will effectively increase the quantization error. As you have already reviewed, when you reduce the number of bits on the quantization, you increase the error introduced in the process by reducing the number of quantization levels available. The question to be asked is: how much error can you tolerate for your application? Or, in other words, how many bits do you really need in order to represent your signal and maintain the desired quality? Figure 2 below shows a sinusoid, its 3-bit quantization version and the resulting error. You will utilize a bit mask to modify the word length of the incoming signal. You have likely utilized masking in a Microprocessors course. It consists of performing a logical AND operation between the data word passed on to the DAC and a

Experiment 2: Sampling and Quantization 4/5 Figure 2. Original Sinusoid, Quantized Sinusoid and Quantization Error mask that you select. Figure 3 below shows a sinusoid and a ramp, quantized with 3 bits, for instance. Notice the 8 levels of the output. (a) Sinusoid Figure 3. A Quantized Sinusoid and a Quantized Ramp (b) Ramp (Sawtooth) You will need to rebuild the project after every change you make on the code. Use an input signal of 1.8V pp and 100Hz to answer the questions below. The reason why you are using 1.8V pp is that you want to use the full voltage range of the CODEC, so that all bits of the word will be used. If you do not have the full range of the signal going into the CODEC, the different masks may not give you the right results. 2. Accomplishments In this experiment, you acquired a better understanding of sampling and quantization by further probing into the limitations of the sampling frequency and the number of bits per sample. You verified the introduction of aliasing by sampling a signal at a rate lower than the one dictated by the sampling theorem. You also verified the consequence of reducing the quantization levels by limiting the number of bits utilized to represent the samples of a signal. Acknowledgments Thanks for all the students who have provided input on the previous versions of this experiment.

Experiment 2: Sampling and Quantization 5/5 References [1] Schafer R. W. Oppenheim A. V. Discrete-Time Signal Processing, 3rd. Ed. Prentice-Hall, 2009. [2] Manolakis D. K. Proakis J. G. Digital Signal Processing, Principles, Algorithms and Applications, 4th. Ed. Prentice-Hall, 2006.