<< Chapter < Page Chapter >> Page >
You will implement band-pass finite impulse-response (FIR) filters with time-domain processing.

Introduction

In this exercise, you will program in the DSP's assembly language and C to create FIR filters. Begin by studying theassembly code for the basic FIR filter filtercode.asm . For help with circular addressing, view Addressing Modes for TI TMS320C55x .

Filtercode.asm

.ARMS_off ;enable assembler for ARMS=0 .CPL_on ;enable assembler for CPL=1.mmregs ;enable mem mapped register names .global _filter.global _inPtr .global _outPtr.copy "macro.asm" ; Copy in macro declaration .sect ".data"FIR_len1 .set 8 ; This is a 8-tap filter .align 32 ; Align to a multiple of 16coef1 ; assign label "coef1" .copy "coef.asm" ; Copy in coefficients.align 32 inputBuffer .space 16*FIR_len1 ; Allocate 8 words of storage for filter statenew_sample_index ; Allocate storage to save index in inputBuffer .word 0.copy "testvect.asm" .sect ".text2"_filter ENTER_ASM ; Call macro. Prepares registers for assemblyMOV #0, AC0 ; Clears AC0 and XAR3MOV AC0, XAR3 ; XAR3 needs to be cleared due to a bug MOV dbl (*(#_inPtr)), XAR6 ; XAR6 contains address to inputMOV dbl (*(#_outPtr)), XAR7 ; AR7 contains address to output BSET AR2LC ; sets circular addressing for AR2MOV #inputBuffer, AR2 ; State pointer is in AR2 MOV mmap(AR2), BSA23 ; BSA23 contains address of inputBufferMOV #new_sample_index, AR4 ; State index pointer is in AR4 MOV *AR4, AR2 ; AR2 contains the index of oldest stateMOV #coef1, AR1 ; initialize coefficient pointerMOV #FIR_len1, BK03 ; initialize circular buffer length for register 0-3 MOV *AR6+<<#16, AC0 ; Receive ch1 into AC0 accumulator MOV AC0, AC1 ; Transfer AC0 into AC1 for safekeepingMOV HI(AC0), *AR2+ ; store current input into state bufferMOV #0, AC0 ; Clear AC0 RPT #FIR_len1-1 ; Repeat next instruction FIR_len1 timesMACM *AR1+,*AR2+,AC0,AC0 ; multiply coef. by state&accumulate round AC0 ; Round off value in 'AC0' to 16 bitsMOV HI(AC0), *AR7+ ; Store filter output (from AC0) into ch1 MOV HI(AC1), *AR7+ ; Store saved input (from AC1) into ch2MOV HI(AC0), *AR7+ MOV HI(AC1), *AR7+MOV AR2, *AR4 ; Save the index of the oldest state back into new_sample_index LEAVE_ASM ; Call macro to restore registersRET

filtercode.asm applies an FIR filter to the signal from input channel 1 and sends the resulting output to outputchannel 1. It also sends the original signal to output channel 2.

First, use the MATLAB command firpm to generate a 20-tap FIR filter. Type doc firpm for information on how to use this command. The filter should pass signals from 4 kHz to 8 kHz. Allow a 1 kHz transition band on each edge of the filter passband. Remember to convert these band edges to digital frequencies based on the 48 kHz sample rate of the system.

Use the save_coef command to save the filter. (Make sure you reverse the vector of filter coefficients before you save them.) Also save your filter as a MATLAB matrix, since you will need them later to generate test vectors. This can be done using the MATLAB save command. Once this is done, use the freqz command to plot the frequency response of the filter.

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ece 420 fall 2013. OpenStax CNX. Sep 26, 2013 Download for free at http://cnx.org/content/col11560/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 420 fall 2013' conversation and receive update notifications?

Ask