Experiment # 2 Pulse Code Modulation: Uniform and Non-Uniform

Similar documents
Experiment # 2. Pulse Code Modulation: Uniform and Non-Uniform

Experiment # 5 Baseband Pulse Transmission

Experiment # 4. Frequency Modulation

Experiment 02: Amplitude Modulation

Contents. Introduction 1 1 Suggested Reading 2 2 Equipment and Software Tools 2 3 Experiment 2

Exploring DSP Performance

Introduction to Lab Instruments

Pulse Code Modulation (PCM)

DIGITAL COMMUNICATION. In this experiment you will integrate blocks representing communication system

Laboratory Assignment 1 Sampling Phenomena

Lab 12 Laboratory 12 Data Acquisition Required Special Equipment: 12.1 Objectives 12.2 Introduction 12.3 A/D basics

LAB II. INTRODUCTION TO LABVIEW

Lab 6: Building a Function Generator

DIGITAL COMMUNICATION

Pulse Code Modulation

Experiment 6: Multirate Signal Processing

ECE159H1S University of Toronto 2014 EXPERIMENT #2 OP AMP CIRCUITS AND WAVEFORMS ECE159H1S

Voice Transmission --Basic Concepts--

TCET3202 Analog and digital Communications II

ECE 2111 Signals and Systems Spring 2012, UMD Experiment 9: Sampling

Introduction to Simulink Assignment Companion Document

17. Delta Modulation

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

ECEn 487 Digital Signal Processing Laboratory. Lab 3 FFT-based Spectrum Analyzer

Waveform Generators and Oscilloscopes. Lab 6

CHAPTER 4. PULSE MODULATION Part 2

ET 304A Laboratory Tutorial-Circuitmaker For Transient and Frequency Analysis

ME 461 Laboratory #2 Timers and Pulse-Width Modulation

Lab 4: Using the CODEC

Using the CODEC ReadMeFirst

Laboratory set-up for Real-Time study of Electric Drives with Integrated Interfaces for Test and Measurement

Digital Communication Prof. Bikash Kumar Dey Department of Electrical Engineering Indian Institute of Technology, Bombay

EEE 309 Communication Theory

EET 223 RF COMMUNICATIONS LABORATORY EXPERIMENTS

Real Analog - Circuits 1 Chapter 11: Lab Projects

Integrators, differentiators, and simple filters

Chapter 2: Digitization of Sound

Experiment # 3. Doppler Spread

ECE 556 BASICS OF DIGITAL SPEECH PROCESSING. Assıst.Prof.Dr. Selma ÖZAYDIN Spring Term-2017 Lecture 2

Memorial University of Newfoundland Faculty of Engineering and Applied Science. Lab Manual

Pulse Code Modulation

ME 365 EXPERIMENT 8 FREQUENCY ANALYSIS

The Fundamentals of Mixed Signal Testing

Getting Started. MSO/DPO Series Oscilloscopes. Basic Concepts

LAB #7: Digital Signal Processing

LABORATORY 4. Palomar College ENGR210 Spring 2017 ASSIGNED: 3/21/17

YEDITEPE UNIVERSITY ENGINEERING FACULTY COMMUNICATION SYSTEMS LABORATORY EE 354 COMMUNICATION SYSTEMS

Digital Communication (650533) CH 3 Pulse Modulation

THE SPEAKER. The decibel scale is related to the physical sound intensity measured in watts/cm 2 by the following equation:

Physics 120 Lab 1 (2018) - Instruments and DC Circuits

Communications I (ELCN 306)

Experiment Guide: RC/RLC Filters and LabVIEW

ECE 3155 Experiment I AC Circuits and Bode Plots Rev. lpt jan 2013

USE OF BASIC ELECTRONIC MEASURING INSTRUMENTS Part II, & ANALYSIS OF MEASUREMENT ERROR 1

Time-Varying Signals

Lab 3 FFT based Spectrum Analyzer

2 AC and RMS. To pass this lab you must solve tasks 1-2. Tasks 3 and 4 are included in the grading of the course.

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

ENSC327 Communication Systems Fall 2011 Assignment #1 Due Wednesday, Sept. 28, 4:00 pm

Laboratory Experiment #1 Introduction to Spectral Analysis

Downloaded from 1

Part 1. Using LabVIEW to Measure Current

EEE 309 Communication Theory

DIGITAL SIGNAL PROCESSING LABORATORY

RC Filters and Basic Timer Functionality

Lab Report #10 Alex Styborski, Daniel Telesman, and Josh Kauffman Group 12 Abstract

ECEGR Lab #8: Introduction to Simulink

Advanced Audiovisual Processing Expected Background

EE 3302 LAB 1 EQIUPMENT ORIENTATION

Notes on Experiment #1

The oscilloscope and RC filters

EE 210 Lab Exercise #4 D/A & A/D Converters

Senior Design Project: Converting an Analog Transceiver into a Digital one

MASSACHUSETTS INSTITUTE OF TECHNOLOGY /6.071 Introduction to Electronics, Signals and Measurement Spring 2006

Experiment 1.A. Working with Lab Equipment. ECEN 2270 Electronics Design Laboratory 1

Lab 1: Simulating Control Systems with Simulink and MATLAB

Digital Audio. Lecture-6

ECE 2111 Signals and Systems Spring 2009, UMD Experiment 3: The Spectrum Analyzer

Fourier Theory & Practice, Part I: Theory (HP Product Note )

AC : INTERACTIVE LEARNING DISCRETE TIME SIGNALS AND SYSTEMS WITH MATLAB AND TI DSK6713 DSP KIT

ENGR 210 Lab 12: Sampling and Aliasing

Presentation Outline. Advisors: Dr. In Soo Ahn Dr. Thomas L. Stewart. Team Members: Luke Vercimak Karl Weyeneth. Karl. Luke

EE-4022 Experiment 2 Amplitude Modulation (AM)

Communications IB Paper 6 Handout 3: Digitisation and Digital Signals

Oscilloscope and Function Generators

Getting started with Mobile Studio.

LAB I. INTRODUCTION TO LAB EQUIPMENT

Introduction to the Analog Discovery

LABORATORY 3 v1 CIRCUIT ELEMENTS

TELECOMMUNICATION SYSTEMS

Exponential Waveforms

On-Line Students Analog Discovery 2: Arbitrary Waveform Generator (AWG). Two channel oscilloscope

ENSC327/328 Communication Systems Course Information. Paul Ho Professor School of Engineering Science Simon Fraser University

E x p e r i m e n t 2 S i m u l a t i o n a n d R e a l - t i m e I m p l e m e n t a t i o n o f a S w i t c h - m o d e D C C o n v e r t e r

Group: Names: Resistor Band Colors Measured Value ( ) R 1 : 1k R 2 : 1k R 3 : 2k R 4 : 1M R 5 : 1M

Experiment 1 Introduction to MATLAB and Simulink

ENGR 1110: Introduction to Engineering Lab 7 Pulse Width Modulation (PWM)

PULSE CODE MODULATION (PCM)

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

Curve Tracer Laboratory Assistant Using the Analog Discovery Module as A Curve Tracer

Transcription:

10 8 6 4 2 0 2 4 6 8 3 2 1 0 1 2 3 2 3 4 5 6 7 8 9 10 3 2 1 0 1 2 3 4 1 2 3 4 5 6 7 8 9 1.5 1 0.5 0 0.5 1 ECE417 c 2015 Bruno Korst-Fagundes CommLab Experiment # 2 Pulse Code Modulation: Uniform and Non-Uniform Name: Experiment Date: Student No.: Day of the week: Time: Name: Student No.: Grade: / 10 E000 Input Signal Mask Output x 10 3 x 10 3 µ 1 [ln(1+mu)]^ 1 ABS X + ln X 10 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 sign 1.5 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 1 Purpose The purpose of this experiment is to introduce uniform and non-uniform pulse code modulation (PCM). Uniform PCM will be explored by varying the effective number of quantization levels and non-uniform PCM will be introduced with the implementation of a µ-law compressor. PCM is a technique widely used in communication systems to provide a digital representation of an analog waveform. This experiment is divided into three parts: 1. You will explore Uniform PCM by modifying the number of bits used to quantize each sample of a signal. You will use different numbers of bits per sample and observe the relationship between the number of bits per sample and quantization noise. 2. You will then simulate a µ-law compressor and modify its parameters to verify the outcomes. 1

3. You will run the µ-law compressor on the DSP platform to observe the results on your oscilloscope. 2 Background Reading and Preparation It is fair to say that every textbook in digital signal processing starts by describing how an analog signal is converted into a digital one prior to being processed. Sampling and quantization are described in detail in many references. Therefore, rather than looking for a single reference for background reading, you can refer to any of the textbooks cited in the bibliography presented at the end of this outline. Keep in mind, however, that these should be seen as introductory reading, since they only touch on PCM as applied to A/D conversion. Some references [1], [2] and [3], look at PCM from the point of view of communication systems, and go beyond A/D conversion. You should review your notes on sampling and quantization, or on analog-to-digital conversion. With the µ-law PCM scheme, the signal will pass through a compressor, which will apply a logarithmic mapping to the incoming signal prior to quantization. The quantization of the compressed incoming signal is then done with a smaller number of bits per sample. The compression method you will utilize in this experiment is defined in the ITU/T G.711 standard. The outcome of µ-law and A-Law compressors is very similar, and both can be implemented in a table look-up algorithm in which the compression curve is stored in an array and the output is generated by mapping the normalized input onto that array. Non-uniform quantization allows for the signal-to-noise ratio to be kept through the dynamic range of the signal. The louder parts of the signal (which are statistically less prevalent in telephony) are quantized with a smaller number of bits than they would with a uniform quantizer, resulting in a lower signal-to-noise ratio. That is, by applying compression prior to quantization, the signal that extends beyond a certain level will likely utilize only a few more bits per sample (the most significant ones) than would a softer signal. In turn, the softer signal will present a higher signal-to-noise ratio than the louder signals, keeping the ratio constant through the dynamic range. Subjectively, compression on a voice signal would be perceived by a loss of quality in the signal for loud talkers. At the receiving end, the compressed signal is passed through an expander and the original signal is recovered. It is possible, for instance, to achieve a compression from 14 bits to 8 bits on a voice signal (a compression ratio of 1.75:1) without much computational complexity. Before coming to the lab, complete the lab preparation and hand it to the T.A.. 2

3 Experiment 3.1 Uniform Quantization This section is divided into three main parts: the simulation of a system presenting aliasing; the modification of sampling rates to verify the occurrence of aliasing on real signals; and the verification of the relation between signal integrity and word length in the quantization process. Differently than previous experiments in other courses where you verified concepts by designing a whole system (such as an FM modulator), this section will touch individually on the two main parts of PCM, namely: sampling and quantization. The reason for taking this approach is primarily due to the fact that the target hardware already provides a CODEC which utilizes PCM to convert the signal from analog to digital. In this section you will modify the data generated by the existing CODEC and observe the consequences of the modifications on the output signal. 3.1.1 Fewer Bits, More Noise You should expect that as you reduce the number of bits assigned per sample of the incoming analog signal, you should obtain a less accurate digital representation. Consider an extreme case in which you have only one bit to represent the samples of a sinusoid. Of course, with only two values possible, one of them would be assigned to every sample in the positive cycle of the sinusoid and the other would be assigned to every sample in the negative cycle. The result would be a square wave with the same period as the original sinusoid. Now consider the frequency domain view of this new signal sampled with only one bit per sample. While the original sinusoidal input signal has one component (ideally an impulse) in the frequency domain, and after quantizing it you have that same component and all of its odd harmonics. This is not at all a faithful representation of the analog signal. As you increase the number of bits, you decrease the amount of quantization noise, achieving a gradually better representation of the signal. The program to be run on the DSP is given to you (it is located at c:/ece417 2015/Exp02/Uniform). Open Code Composer Studio and open the project named quantization.pjt. Look briefly at the code. You are to change the code to modify the number of bits used for each sample of the input signal. The CODEC provides 16 bits for each sample on each channel. You will force the samples for one of the channels to be quantized by using only a reduced number of bits. 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. So, should you modify the MSBs or the LSBs to accomplish this? The operation you will utilize to modify the word length of the incoming signal is known as masking, and you likely have already made use of it in a Microprocessors course. It consists of performing a logical AND operation between the data word passed on to the DAC and a mask that you select. Looking at your quantization.c program, you will notice that there are several masking options for the y variable. Use only one mask at a time, and comment out the others. You may change the mask to answer the questions below. Do not forget to recompile and run the program every time you make a change. 3

Use an input signal of around 2.7 Vpp and 100 Hz. You can choose to use a sine wave or a ramp. The reason you are using 2.7 Vpp is that you must utilize the full range of the CODEC. If you do not have the full range of the signal going into the CODEC, you will not get the right results. You are to implement a 3-bit quantizer using an appropriate mask. What should the mask be? How many quantization levels are there? Explain what part of the sample 16-bit field the mask is selecting. (1pt) Sketch the original signal, the quantized signal, and the quantization error by using the Subtraction function in Math mode on the oscilloscope. The quantization error is the difference between the original signal and its quantized version. (2pts) Show your quantization error output on the oscilloscope to the TA, and have the TA sign here. (1pt) 4

3.2 Non-Uniform Quantization In this part, you will simulate first and then run a µ-law compressor. On this second part, you will use a sinusoid and a ramp, and will observe the resulting compressed output on the oscilloscope. You will be required to understand the implementation of the compressor and relate it back to the theory, and to verify the characteristic curves for different parameter values. This is a fancy way of saying: vary the level at the input, read the level at the output and plot points for every level. 3.2.1 Simulation of a µ-law Compressor It is assumed that you are familiar with Simulink. If you can t find the simulation blocks you are looking for, you can run a search within Simulink. Remember that you will never use continuoustime systems in the ECE417 experiments, and the sampling period of your blocks must be set to 1/48000, so that the system you simulate is representative of that you will implement on the DSP target. Not every block requires that you set a sampling period. Those which do require, must be set to 1/48000. Your first system will be made of a DSP-Sine wave generator, a ramp generator, a switch, your compressor of choice found in the ECE417 blockset and two time-based scopes. You can use the template file exp02 sim.mdl provided in the c:/ece417 2015/Exp02/NonUniform directory. It will look like Figure 1 below. Figure 1: Non-Uniform PCM - model for simulation Use scopes to view the output of the generators and to view the output of the compressor. Your sine wave and ramp signals should be set to 1000 Hz, amplitude of 1 and sampling frequency of 48 khz (this means sampling period of 1/48000 in the proper field of the sine wave generator 5

block). Run the system and configure the time-based scopes to provide you with the best reading. You should observe the scopes looking like Figure 2 (notice the maximum level of 1). (a) µ-law Ramp (b) µ-law Sine Figure 2: Scope Displays After Compression: Ramp and Sine Since you are simulating a µ-law compressor, use first a µ value of 255. As you know from your preparation, this is a standard value and is equivalent to an A-Law value of 87.6. They are determined through subjective voice tests (Mean Opinion Score). If you right-click on the Mu-Law Compressor block, and select look under mask, a window will open with the block diagram presented in Figure 3 (comments were added for clarity). Figure 3: µ-law Compressor - modified from Simulink Library 6

After you got these models going, answer the question below: Now you will draw the characteristic curve for your compressor. You will use four values for the constant, vary the input signal amplitude from 0.01 to 1.0 and measure the output (pick five points and draw the graph with input amplitude on the x axis, and output amplitude on the y axis). Use a sine as an input. Use the values 0, 10, 255 and 1000 for µ. Draw the graph for every value of the constant (that is µ) and comment on your results.(3pts) You could, alternatively, use an XY Graph found in the main blockset in Simulink to view the curves. Your simulation model would then look like that shown in Figure 4. Since you are interested in input values from 0 to 1, you should set the axis of your XY Graph to those values by right-clicking on the block. Figure 4: Alternative simulation with XY Graph Show the XY scope running and have the TA sign the box. (1pt) 7

3.3 Implementing and Evaluating µ-law or A-Law Compressors In this part of the experiment, you will run your compressor on a DSP platform. Keep in mind that this compression is applied prior to assigning bits to the levels (remember uniform PCM above?), so that the most compressed (higher) signal levels will have less room to maneuver, as you have just observed in the simulation. At the receiving end, the signal will be expanded back to its original shape. Systems which implement compression and expansion are known as companders. Here you will be given the necessary executable programs to be loaded and run on the DSP platform. If you would like to design your own compander some other time, refer to [4]. The procedure to download the executable program is as follows: With the target powered on, open Code Composer Studio. You will notice the LEDs blink while CCS is coming up. If you want to check the target, go under GEL (top menu)/ Check DSK / QuickTest. This should cause the LEDs to blink again and a message will appear on the I/O panel of CCS. Go under File (top menu) / Load Program. This will open a window from which you will select your program. The executable program is of type.out. All programs for this experiment will be found in the directory C:/ECE417 2015/Exp02/NonUniform/Executables. After you select the file and click OK, the executable will be loaded onto the target memory. Now you can go under Debug (top menu)/ Run, or press F5 or click on the running man on the vertical panel on the left of the CCS window to run the program. As a special feature of Code Composer Studio you may have to load it twice only for the first load. Go figure. Test your hardware first to see if it is implementing compression as it should. Use a ramp input (2.7 Vpp, 1 khz) and observe the output. Then use a sinusoid with the same parameters. Notice that the higher levels are the ones being punished by the compression. You already know how this should look from the simulation portion of this experiment. First, load the executable program for your compressor of choice with the standard parameter value (for µ it is 255). Load the executable program with the largest parameter value. If you decrease the gain of the input signal, do you expect the compressed signal to appear better or worse? Why? Does your system behave as you expect? (1pt) 8

To finalize your experiment and to convince yourself that µ-law and A-Law are similar compression standards, load the executable in which one channel is compressed using A-Law and the other is compressed using µ-law (the name of the program is alawmulaw.out). Can you tell if there is a difference? Lower the input voltage, and bring it back to 2.7 Vpp to observe the effect of both compressors. Show the running system to the TA, and have the TA sign the box. (1pt) 4 Accomplishments In this experiment, you acquired a better understanding of Pulse Code Modulation by further probing into uniform and non-uniform quantization. You verified the impact caused by the number of bits on quantization noise, and also verified the effect of different µ values on the compression of a signal. References [1] S. Haykin and M. Moher Introduction to Analog and Digital Communications, 2nd Ed. - Wiley, 2007 [2] B. P. Lathi, Modern Digital and Analog Communication Systems, 3rd Edition. New York: Oxford University Press, 1998. [3] S. Haykin Communication Systems, 4th Edition. Toronto: John Wiley & Sons, Inc., 2001. [4] P. M. Embree, C Algorithms for Real-Time DSP, Prentice-Hall, 1995. 9

Preparation Uniform and Non-Uniform Quantization Name: Experiment Date: Student No.: Grade: / 10 1. Sketch the process of sampling and quantization for a 1 khz sine wave sampled at 8 khz. You are to use a 3 bit quantizer and assume linear quantization. Use your illustration to explain quantization noise. (2pt) 2. Write the equations for µ-law and A-Law compression. What are the typical values for the µ parameter and the A parameter? (assume 8 bits)(2pt) 10

3. Based on your experience in Simulink, draw a block diagram to implement a µ-law OR an A-Law compressor.(2pt) 4. Explain how the use of non-uniform quantization causes the SNR to become almost independent of the input signal power for a large dynamic range.(2pt) 5. You have a speech signal and a sinusoidal signal. Based on your knowledge of their probability density function, explain on which of them it would be most appropriate to apply non-uniform quantization. (2pt) 11