DOC PREVIEW
Brown EN 164 - Laboratory Exercise 1

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Laboratory Exercise 1: A DSP-Based Interference Filter and Automatic GainControl System Introduction: In 1984, the compact disc was developed by Phillips Laboratory in BriarcliffManor, New York. Today, digital technology has expanded to play an essential role inmusic. The data that powers your speakers and headphones is now all digital, and thisdata is manipulated to do tone compensation and room equalization through digitalfiltering techniques.Digital technology is also important not only to music, but to any area thatinvolves sound. The basic function of a hearing aid is to filter the microphone signal tomatch the limited hearing range of the user. Hearing aids must also adjust their gaindepending on the level of a signal in the room. Put another way, one needs to boost asignal to a fairly loud level without damaging the ears, and one needs to boost the signalin a way that does not distort the signal when the room noise level increases. Mostimportantly, one needs to do this in such a way that it occurs in a fraction of a secondwithout the intervention of the user. A circuit that can achieve this is known as anAutomatic Gain Control (AGC) circuit.In this laboratory, you will observe the value of filtering and AGC throughmusical means rather than through hearing aids. You will program a SHARC evaluationboard with a ADSP21061 processor to do both filtering and AGC on a digital signalstream. The board consists of a two channel code chip that contains an analog to digitalconverter (ADC) and a digital to analog converter (DAC). We will provide code thattakes data from the ADC, stores blocks of data, and puts it back on the DAC. Your job isto modify our program to write the filtering and AGC portion. Requirements:Write an assembly language program for an Analog Devices SHARC processor todo notch filtering, AGC, both, or neither on a digital signal stream. There are twoswitches on the board that your program should read to determine whether data isfiltered, AGCed, both or neither. Your code must be efficient enough to work at samplingrates up to 44 kHz.Support Code:We have provided a template file for your assembly-language subroutine called“DSP-Lab_00.asm”. Make a copy of that file and modify it to complete the lab. There are also source code and object code for a mixed C and assembler programthat Professor Patterson wrote by modifying the Analog Devices “TalkThru” program.You are welcome to look at the source code, but its details are of little real interest. Whenthe DSP-Lab_00.asm routine is properly assembled and linked with the support code, it iscalled periodically whenever there are 512 new data points available to process. Thosedata are 32-bit fixed-point integers whose magnitudes are always less than 32768. (Theystart as 16-bit 2's complement numbers from the codec and are sign extended to 32 bits.)You must write SHARC assembler code to do the filtering and AGC control on this dataand write it back to an output buffer for the calling program to send to the codec.The template file has clearly marked places for allocating space for variables andbuffers in both program and data memory. The place for your code is also indicated.There is a header section with definitions for SHARC parameters and for some constantsused in the algorithms. Finally, the code section has a short piece of program that wasoriginally used to check that the template worked. It copies the fixed-point input datadirectly to the output buffer. This code is now commented out, and you should remove italtogether before turning in your code. It was left it in place so you would have a simpleguide to common syntax and could use it as an example of retrieving and returning thesignal data.Algorithms:General Algorithm: When your subroutine is called, the address of the start of the input data array, effectively a pointer to the array, is stored in data memory at the location _InAddress . (The leading underscore is necessary!) You can retrieve that pointer to a register, say to register i1, with the expression i1 = dm(_InAddress); . Similarly the memory location _OutAddress has the address of where to place your output data. Do not modify these pointers! Your code must do the following:1. Retrieve 512 integer inputs from the array at _InAddress. Convert them tofloating point numbers (Floating-point conversion is necessary because both theprocessing algorithms use floating-point numbers) and store them contiguouslyto the last set of data in a buffer of your own. Very likely you would use acircular buffer to make building the filtering algorithm easier. (The final sectiontalks about these buffers as does the material on DAGs in the manual.)2. There is an integer in the range {0,3} passed to you in the memory location_InFlags . If this number is 1 or 3, apply finite impulse response (FIR) filtering.If it is 2 or 3, apply AGC. Both algorithms are discussed in more detail below.3. After you have finished the calculations, convert the filtered values to fixed-point numbers and write those out to the output buffer at _OutAddress .FIR Filtering Algorithm:We have provided a set of filter coefficients, that is, a set of constants, in programmemory. The number of such coefficients is given in a #define statement at the top of thecode as NCOEFFS. Suppose that the data in your floating-point buffer are called {fi} where i is anindex corresponding to sample number. (This index simply increases continuously withtime. Since there is only a finite amount of memory, the buffer locations are cyclic and iamounts to an index through the buffer). The filtering formula is:10NCOEFFSjjijifcxwhere cj is the jth coefficient and xi is the ith output of the filter. On subroutine entry, thevalues of these coefficients are found in program memory as an array starting at address“_coefs”. Each filter output is affected only by the current input and by the lastNCOEFFS-1 inputs. Therefore, when your subroutine is called, you will need the datafrom the time it was called previously. Thus you will save two frames of input data,replacing the oldest when necessary. You will have to store the new outputs {xi} in aseparate working storage area.The digital filter is primarily a notch filter, that is, it removes a portion of


View Full Document

Brown EN 164 - Laboratory Exercise 1

Download Laboratory Exercise 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Laboratory Exercise 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Laboratory Exercise 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?