mpsravi dsplab

Upload: karthiha12

Post on 14-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 MPSRAVI DSPLAB

    1/65

    DSP LAB EEE

    MAHENDRA ENGINEERING COLLEGE

    MAHENDRAPURI, MALLASAMUDRAM (WEST),

    NAMAKKAL Dt - 637503

    DEPARTMENT OF ECE

    DIGITAL SIGNAL PROCESSING LABORATORY

    Observation Manual

    Name: _________________________ Reg. No.: ______________________

    Class: _____________________

  • 7/30/2019 MPSRAVI DSPLAB

    2/65

    DSP LAB EEE

    DIGITAL SIGNAL PROCESSING LABORATORYEXTRACT OF UNIVERSITY SYLLABUS

    LIST OF EXPERIMENTS:

    USING MATLAB CODES:

    1. Representation of basic signals.

    2. Verification of sampling theorem.

    3. Computation of Circular Convolution.

    4. Checking stability of LTI systems.

    5. Finding Fast Fourier Transform.

    6. Design Chebyshev analog and Digital filters.

    7. Design of Butterworth analog and Digital filters.

    8. Design and analysis of FIR filter using windows

    USING TMS320C5X/54XX:

    1. Generation of Signals

    2. Linear Convolution

    3. Implementation of a FIR filter

    4. Implementation of an IIR filter

    5. Calculation of FFT

  • 7/30/2019 MPSRAVI DSPLAB

    3/65

    DSP LAB EEE

    DIGITAL SIGNAL PROCESSING LABORATORY

    Exp.

    No.Experiment Name Marks (15) Staff Sign

    CYCLE 1: DSP USING MATLAB

    1 Representation of basic signals.

    2 Verification of sampling theorem.

    3 Computation of Circular Convolution.

    4 Checking stability of LTI systems

    5 Finding Fast Fourier Transform

    6 Design Chebyshev analog and Digital filters

    7Design of Butterworth analog and Digitalfilters

    8Design and analysis of FIR filter using

    windows

    CYCLE 2: DSP USING TMS320C5X

    1 GENERATION OF SIGNALS

    2 LINEAR CONVOLUTION

    3 IMPLEMENTATION OF A FIR FILTER

    4 IMPLEMENTATION OF IIR FILTER

    5 CALCULATION OF FFT

    AVERAGE:

    STAFF-IN CHARGE

  • 7/30/2019 MPSRAVI DSPLAB

    4/65

    DSP LAB EEE

    INTRODUCTIONWHAT IS MATLAB?

    MATLAB is a high-performance language for technical computing. Itintegrates

    computation, visualization, and programming in an easy-to-useenvironment whereproblems and solutions are expressed in familiar mathematical notation. Typical sesinclude:

    Math and computation

    Algorithm developmentModeling, simulation, and prototyping

    Data analysis, exploration, and visualizationScientific and engineering graphics

    Application development, including graphical user interface building MATLAB is

    an interactive system whose basic data element is an array that does not requiredimensioning. This allows you to solve many technical computing problems,

    especially those with matrix and vector formulations, in a fraction of the time itwould take to write a program in a scalar non interactive language such as C or

    Fortran.

    The name MATLAB stands formatrix laboratory.

    MATLAB was originally written to provide easy access to matrix softwaredeveloped by the LINPACK and EISPACK projects, which together represent thestate-of-the-art in software for matrix computation.

    MATLAB has evolved over a period of years with input from many users. In

    university environments, it is the standard instructional tool for introductory andadvanced courses in mathematics, engineering, and science. In industry, MATLAB

    is the tool of choice for high-productivity research, development, and analysis.MATLAB features a family of application-specific solutions called toolboxes.

    Very important to most users of MATLAB, toolboxes allow you to learn and apply

    specialized technology. Toolboxes are comprehensive collections of MATLABfunctions (M-files) that extend the MATLAB environment to solve particular classes

    of problems. Areas in which toolboxes are available include signal processing,control systems, neural networks, fuzzy logic, wavelets, simulation, and manyothers.

  • 7/30/2019 MPSRAVI DSPLAB

    5/65

    DSP LAB EEE

    Hierarchy of arithmetic operations:

    First The contents of all parentheses are evaluated first, startingfrom the innermost parentheses and working outward

    Second All exponentials are evaluated, working from left to right

    Third All multiplications and divisions are evaluated, workingfrom left to right

    Fourth All additions and subtractions are evaluated, startingfrom left to right

    Example:

    >> 1/(2+3^2)+4/5*6/7

    ans = 0.7766

    Basic Notations in MATLAB

    xlabel(time); % label the x-axis with time

    ylabel(amplitude); % label the y-axis with amplitudetitle(xxxxx); % put a title on the plot

    clear; % clears the workspace, all variablesare removed.

    clear all; % clears all variables and functionsfrom work space.

    clc; % clears command window,command history is lost.

    plot(x,y) % plot x Vs y.axis tight; % set tight scale on axes.zeros(m,n) % returns an m by n matrix of zeros.

    fliplr % flips a matrix from left to right.abs % absolute value.

    Exp: abs(A) produces a matrix

    of absolute values |Aij|angle % phase angleconj % complex conjugate

    abs % converts character arrays usingautomatic padding.

    x=0:.1:20; % create vector xb=[2;3;5]; % create vector b

  • 7/30/2019 MPSRAVI DSPLAB

    6/65

    DSP LAB EEE

    The graphical interface to the MATLAB workspace

  • 7/30/2019 MPSRAVI DSPLAB

    7/65

    DSP LAB EEE

    Ex. No. : 1REPRESENTATION OF BASIC SIGNALS

    Date:

    Aim:

    To write a MATLAB program to generate various input Waveforms.

    Hardware/software requirement

    S.NO Hardware/software1 PC with XP operating system.

    2 Matlab 2007b

    1. Unit Impulse response

    Algorithm:

    STEP 1: Start the program.

    STEP 2: Get the range of sequence n1, s1 for various signalsSTEP 3: Generate the unit impulse response

    STEP 4: Plot the sequence by taking n1 along xaxis and s1alone

    yaxis.STEP 5: Stop the program.

    Program:

    clc;

    clear all;close all;

    s1=[zeros(1,20) 1 zeros(1,20)];n1=-20:20;

    subplot(2,2,1);stem(n1,s1);

    grid on;title('Unit Impulse Function');

    xlabel('time');ylabel('amplitude');

  • 7/30/2019 MPSRAVI DSPLAB

    8/65

    DSP LAB EEE

    2. Unit step response

    Algorithm:

    STEP 1: Start the program.STEP 2: Get the range of sequence n2, s2 for various signals

    STEP 3: Generate the unit step responseSTEP 4: Plot the sequence by taking n2 along xaxis and s2

    along yaxisSTEP 5: Stop the program

    Program:

    clc;

    clear all;close all;s2=[zeros(1,20) ones(1,21)];

    n2=-20:20;subplot(2,2,2);

    stem(n2,s2);grid on;

    title('Unit Step Function');xlabel('time');

    ylabel('amplitude');

    3. Unit Ramp function

    Algorithm

    STEP 1: Start the program.STEP 2: Get the range of sequence n3, s3 for various signals

    STEP 3: Generate the unit ramp response

    STEP 4: Plot the sequence by taking n3 along xaxis and s3along yaxis

    STEP 5: Stop the program

  • 7/30/2019 MPSRAVI DSPLAB

    9/65

    DSP LAB EEE

    Program:

    clear all;close all;

    s3=[zeros(1,20) 0:20];n3=-20:20;

    subplot(2,2,3);stem(n3,s3);

    grid on;title('Unit Ramp Function');

    xlabel('time');ylabel('amplitude');

    4. Exponential function

    Algorithm:

    STEP 1: Start the program.

    STEP 2: Get the range of sequence n4, s4 for various signalsSTEP 3: Generate the unit impulse response

    STEP 4: Plot the sequence by taking n4 along xaxis and s4 alongyaxis.

    STEP 5: Stop the program

    Program:

    clear all;close all;

    n4=0:0.01:1;s4=exp(n4);

    subplot(2,2,4);stem(n4,s4);

    grid on;title('Exponential Function');

    xlabel('time');ylabel('amplitude');

  • 7/30/2019 MPSRAVI DSPLAB

    10/65

    DSP LAB EEE

    5. Cosine function

    Algorithm

    STEP 1 : Start the program.STEP 2 : Get the range of sequence n5, s5 for various signals

    STEP 3 : Generate the cos wave using function of cos expression

    s5=a*cos(2*n5*pi*c); STEP 4 : Plot the sequence by taking n5 along xaxis and s5 .

    along yaxisSTEP 5: Stop the program

    Program:

    clear all;

    close all;f=input('Enter the frequency of value:');

    f1=input ('Enter the sampling freq:');a=input ('Enter the amplitude of freq:');

    c=f/f1;n5=0:0.1:10;

    s5=a*cos(2*n5*pi*c);plot(n5,s5);

    title('Cosine wave generation');xlabel('Time in milliseconds');

    ylabel('Amplitude');

    6. Sin Function:

    Algorithm

    STEP 1 : Start the program.

    STEP 2 : Get the range of sequence n6, s6 for various signalsSTEP 3 : Generate the cos wave using function of cos expression

    s6=sin(2*pi*t6);STEP 4 : Plot the sequence by taking n6 along xaxis and s6

    along yaxis.

    STEP 5: Stop the program

  • 7/30/2019 MPSRAVI DSPLAB

    11/65

    DSP LAB EEE

    Program:

    clear all;close all;

    t6=0:.01:pi;s6=sin(2*pi*t6);

    plot(t6,s6);title('sine sequence');

    ylabel('amplitude');xlabel('time');

    7. SAWTOOTH FUNCTION:

    Algorithm

    STEP 1: Start the program.STEP 2: Get the range of sequence n7, s7 for various signals

    STEP 3: Generate the saw tooth waveSTEP 4: Plot the sequence by taking n7 along xaxis and s7

    along yaxis.STEP 5: Stop the program

    Program

    clear all;

    close all;n7=0:0.1:5;s7=sawtooth(2*pi*n7);

    subplot(2,2,3);stem(n7,s7);

    grid on;

    title('sawtooth Function');xlabel('time');ylabel('amplitude');

  • 7/30/2019 MPSRAVI DSPLAB

    12/65

    DSP LAB EEE

    8. Square Function

    Algorithm:

    STEP 1 : Start the program.

    STEP 2 : Get the range of sequence n8, s8 for various signalsSTEP 3 : Generate the square waveSTEP 4 : Plot the sequence by taking n8 along xaxis and s8

    . along yaxisSTEP 5: Stop the program

    Program:

    clear all;

    close all;n8=0:0.1:1;s8=square(2*pi*5*n8);

    subplot(2,2,4);stem(n8,s8);

    grid on;title('Square Function');

    xlabel('time');ylabel('amplitude');

    PROCEDURE:

    1. Open the MATLAB.2. Create a edit window3. Type the relevant programs.4. Save the file5. Run the program by using icon (or) select debug and select Run

    (or) press F5.

    6. If any error present in the program, it will be displayed in the. command prompt >>

    7. To check the errors and rectify that errors in the program againrun the program.

    8. If no error occurs, the output waveform will be obtained.Print the output

  • 7/30/2019 MPSRAVI DSPLAB

    13/65

    DSP LAB EEE

    VIVA QUESTION:

    RESULT:

  • 7/30/2019 MPSRAVI DSPLAB

    14/65

    DSP LAB EEE

    Ex. No. : 2VERIFICATION OF SAMPLING THEOREM

    Date:

    Aim:To write the program for verification of sampling theorem using MATLAB.

    Hardware/software requirement

    S.NO Hardware/software

    1 PC with XP operating system.

    2 Matlab 2007b

    Algorithm:

  • 7/30/2019 MPSRAVI DSPLAB

    15/65

    DSP LAB EEE

    Program:

    clear;close all;

    clc;T=5;

    Np=512;t =linspace(0,T,Np+1);

    f=2;x=sin(2*pi*f*t);

    N=8;Ts=T/N;

    fs=1/Ts;

    ts=Ts*(0:N-1);xs=sin(2*pi*f*ts);h=round(f/fs);

    fapp=f-h*fs;xa=sin(2*pi*fapp*t);

    figure;plot(t,x,'r-',ts,xs,'b*',t,xa,'m-');

    title('Signal sampling at 1.6 Hz');axis tight;

    xlabel('time'); ylabel('signal value');

    N=16;

    Ts=T/N;Fs=1/Ts;

    ts=Ts*(0:N-1);xs=sin(2*pi*f*ts);

    h=round(f/fs);fapp=f-h*fs;

    xa=sin(2*pi*fapp*t);

    figure;plot(t,x,'r-',ts,xs,'b*',t,xa,'m-');title('Signal sampling at 3.2 Hz');

    axis tight;xlabel('time'); ylabel('signal value');

  • 7/30/2019 MPSRAVI DSPLAB

    16/65

    DSP LAB EEE

    N=32;Ts=T/N;

    Fs=1/Ts;ts=Ts*(0:N-1);

    xs=sin(2*pi*f*ts);h=round(f/fs);

    fapp=f-h*fs;xa=sin(2*pi*fapp*t);

    figure;plot(t,x,'r-',ts,xs,'b*',t,xa,'m-');title('Signal sampling at 6.4 Hz');

    axis tight;xlabel('time');

    ylabel('signal value');

    PROCEDURE:

    1. Open the MATLAB.2. Create a new file from file menu. Click new and select M-file.3. Type the relevant programs.4. Save the file.5. Run the program by using icon (or) select debug and select Run (or)

    press F5

    6. If any error present in the program, it will be displayed in thecommand prompt >> .

    7. To check the errors and rectify that errors in the program again run theprogram

    8. If no error occurs, the output waveform will be obtained.9. Print the output.

  • 7/30/2019 MPSRAVI DSPLAB

    17/65

    DSP LAB EEE

    Viva voice:

    Result:

  • 7/30/2019 MPSRAVI DSPLAB

    18/65

    DSP LAB EEE

    Ex. No. : 3CIRCULAR CONVOLUTION

    Date:

    Aim:To write a program for c ircular convolution using MATLAB.

    Hardware/software requirement:

    S.NO Hardware/software

    1 PC with XP operating system.

    2 Matlab 2007b

    Algorithm:

    1. Enter the value for n and x(n).2. Make the length of the sequence equal.3. Compute the convolution using shift value.4. Plot the result.

    Program:

    %Program for Circular Convolution

    clear all;

    N=input ('enter the values of n:');disp('enter the values for x(n):');

    for i1=1:Nx(i1)=0;

    x1(i1)=0;h(i1)=0;

    end;for i1=1:N

    x(i1)=input ('enter value:');end;

    disp('enter the value for h(n):');for i1=1:N

  • 7/30/2019 MPSRAVI DSPLAB

    19/65

    DSP LAB EEE

    h(i1)=input ('enter the value:');end;

    k1=0;j1=0;

    for g1=1:Ni1=0;

    a=0;for m1=1:N;

    j1=j1+1;i1=i1+1;a=a+(x(i1)*h(j1));

    if N==j1j1=0;

    end;

    end;disp(a);k1=k1+1;

    j1=k1;if N==k1

    break;end;

    end;

    procedure:

    1. Open the MATLAB.2. Create a new file from file menu. Click new and select M-file.

    3. Type the relevant programs.4. Save the file.

    5. Run the program by using icon (or) select debug and select6.Run (or) press F5.

    7. If any error present in the program, it will be displayed in the

    command prompt >> .8. To check the errors and rectify that errors in the program againrun the program.9. If no error occurs, the output waveform will be obtained.

    10. Print the output

  • 7/30/2019 MPSRAVI DSPLAB

    20/65

    DSP LAB EEE

    Viva -voice

    Result:

  • 7/30/2019 MPSRAVI DSPLAB

    21/65

    DSP LAB EEE

    Ex. No. : 4

    CHECKING STABILITY OF LTI SYSTEMS.Date:

    Aim:

    To write a MATLAB program for to check the stability of a system

    Hardware/software requirement:

    S.NO Hardware/software

    1 PC with XP operating system.

    2 Matlab 2007b

    Algorithm:

    STEP 1: Start the program

    STEP 2: Get the Input as Numerator and Denominator Coefficients

    STEP 3: Convert the transfer function to pole zero plot

    STEP 4: Find the Absolute values of the poles.

    STEP 5: Check whether it is greater than unity, if so display Unstable

    system, or else, display it as stable system

    STEP 6: If the values lies on the circle, Display as conditionally stable

    system

    Program:

    %Program to find a system as stable or unstable system

    clc;

    close all;

    clear all;

    a=input('enter the numerator of H(z):');

    b=input('enter the denominator of H(z):');

    zplane(a,b);

  • 7/30/2019 MPSRAVI DSPLAB

    22/65

    DSP LAB EEE

    [z,p,u]=tf2zp(a,b);

    c=length(p);

    r=abs(p);

    x=0;

    if c==0;

    x=1;

    else

    for i=1:c;

    if r(i)>1;

    x=x+2;elseif r(i)==1;

    x=x+1;

    disp('conditionally stable');

    break;

    end

    end

    if x>1;

    disp('unstable system');

    elseif x==0;

    disp('condition is stable');

    end

    end

    Procedure:

    1. Open the MATLAB.

    2. Create a new file from file menu. Click new and select M-file.3. Type the relevant programs.

    4. Save the file.

  • 7/30/2019 MPSRAVI DSPLAB

    23/65

    DSP LAB EEE

    5. Run the program by using icon (or) select debug and select6.Run (or) press F5.

    7. If any error present in the program, it will be displayed in thecommand prompt >> .

    8. To check the errors and rectify that errors in the program againrun the program.

    9. If no error occurs, the output waveform will be obtained.10. Print the output

    Viva voice:

    RESULT:

  • 7/30/2019 MPSRAVI DSPLAB

    24/65

    DSP LAB EEE

    Ex. No. : 5CALCULATION OF FFT OF A SIGNAL

    Date:

    Aim:To write a MATLAB program for computing FFT of a signal using

    DIF.

    Hardware/software requirement:

    S.NO Hardware/software

    1 PC with XP operating system.

    2 Matlab 2007b

    Algorithm:

    STEP 1: Start the process

    STEP 2: Get the Input sequence.STEP 3: Compute the Real and Imaginary parts of the spectrum

    STEP 4: Calculate the FFTSTEP 5: Plot the Amplitude and Frequency in x & y axis

    respectively

    STEP 6: Stop the program

    Program:

    %Program For Computation of FFT Using DIF

    clear all;

    close all;disp('Decimation in frequency');

    disp(' Input in normal order');disp(' ************************');

    n=input ('Enter n points:');for i1=1:n

    x0(i1)=input('Enter a number');x1(i1)=0;

    end;m=log2(n);

  • 7/30/2019 MPSRAVI DSPLAB

    25/65

    DSP LAB EEE

    for(i1=1:m)p1=n/(2^i1);

    p=n/(p1*2);q=n/p;

    for j1=1:q:nr=j1;

    for k=1:q/2a=x0(r);

    b=x0(r+(q/2));w=cos(2*pi*(k-1)/q)-j*sin(2*pi*(k-1)/q);c=a+b;

    d=(a-b)*w;x1(r)=c;

    x1(r+(q/2))=d;

    r=r+1;end;

    end;

    x0=x1;x2=x1;

    x1=0;end;

    disp('Output in scrambled order:');disp( ' n point DIF of radix 2 is:');

    disp(x2);

    Procedure:

    1. Open the MATLAB.

    2. Create a new file from file menu. Click new and select M-file.3. Type the relevant programs.

    4. Save the file.5. Run the program by using icon (or) select debug and select

    6.Run (or) press F5.

    7. If any error present in the program, it will be displayed in thecommand prompt >> .8. To check the errors and rectify that errors in the program againrun the program.

    9. If no error occurs, the output waveform will be obtained.10. Print the output

  • 7/30/2019 MPSRAVI DSPLAB

    26/65

    DSP LAB EEE

    Viva -voice

    Result:

  • 7/30/2019 MPSRAVI DSPLAB

    27/65

    DSP LAB EEE

    Ex. No. : 6 DESIGN CHEBYSHEV ANALOG AND

    DIGITAL FILTERSDate:

    Aim:To write a program to design a chebyshev low pass filter

    1. Impulse invariant method2. Bilinear Transform using MATLAB.

    Hardware/software requirement:

    S.NO Hardware/software

    1 PC with XP operating system.

    2 Matlab 2007b

    Algorithm:1. Get the all the gain & band frequency2. Select the method by switch case3. Plot the magnitude & phase response for Each method

    Program:

    % Program For Chebyshev Filter

    wp=input('Enter the passband frequency:');ws=input('Enter the stopband frequency:');

    r1=input('Enter the passband gain in db:');r2=input('Enter the stopband gain in db:');

    disp('1-bilinear;2-impulse invariance method');choice=input('enter the choice');

    switch(choice)

    case 1,

    % Bilinear Method

  • 7/30/2019 MPSRAVI DSPLAB

    28/65

    DSP LAB EEE

    [n,wn]=cheb1ord(wp,ws,r1,r2,'s');[z,p,k]=cheb1ap(n,.9976);

    [num,den]=zp2tf(z,p,k);[numt,dent] = lp2lp(num,den,wn);

    [bz,az]=bilinear(numt,dent,1)[h,w]=freqz(bz,az,512);

    plot(w/pi,20*log10(abs(h)));grid;title('Chebyshez lowpass filter(Bilinear)');

    xlabel('Normalised frequency');ylabel('Gain-db');

    case 2,

    % Impulse Invariance Method

    [n,wn]=cheb1ord(wp,ws,r1,r2,'s');[z,p,k]=cheb1ap(n,.7648);

    [num,den]=zp2tf(z,p,k);[numt,dent] = lp2lp(num,den,wn);

    [bz,az]=impinvar(numt,dent,1)[h,w]=freqz(bz,az,512);

    plot(w/pi,20*log10(abs(h)));grid;title('Chebyshez lowpass filter(Impluse invariance)');

    xlabel('Normalised frequency');ylabel('Gain-db');end;

    Procedure:1. Open the MATLAB.

    2. Create a new file from file menu. Click new and select M-file.3. Type the relevant programs.4. Save the file.

    5. Run the program by using icon (or) select debug and select6.Run (or) press F5.

    7. If any error present in the program, it will be displayed in thecommand prompt >> .

    8. To check the errors and rectify that errors in the program againrun the program.

    9. If no error occurs, the output waveform will be obtained.10. Print the output

  • 7/30/2019 MPSRAVI DSPLAB

    29/65

    DSP LAB EEE

    VIVA QUESTION:

    RESULT:

  • 7/30/2019 MPSRAVI DSPLAB

    30/65

    DSP LAB EEE

    Ex. No. : 7DESIGN OF BUTTERWORTH ANALOG AND

    DIGITAL FILTERSDate:

    Aim:

    To write a program for Butterworth low pass filter by

    i) Impulse invariant method

    ii) Bilinear Transform using MATLAB

    Hardware/software requirement:

    S.NO Hardware/software

    1 PC with XP operating system.

    2 Matlab 2007b

    Algorithm:

    a. Get the all the gain & band frequencyb. Select the method by switch casec. Plot the magnitude & phase response for

    Each method

    Program:

    %Program For Butterworth low pass Filter

    clc; clear all;close all;wp=input('Enter the passband frequency :');

    ws=input('Enter the stopband frequency :');r1=input('Enter the passband gain in db :');

    r2=input('Enter the stopband gain in db :');

    disp('1-bilinear ; 2-impulse invariance method');

  • 7/30/2019 MPSRAVI DSPLAB

    31/65

    DSP LAB EEE

    choice=input('enter the choice');switch(choice)

    case 1,%Bilinear Method

    [n,wn]=buttord(wp,ws,r1,r2,'s');

    [z,p,k]=buttap(n);[num,den]=zp2tf(z,p,k);[numt,dent] = lp2lp(num,den,wn);

    [bz,az]=bilinear(numt,dent,1);[h,w]=freqz(bz,az,512);

    plot(w/pi,20*log10(abs(h)));

    grid;title('Butterworth lowpass filter(Bilinear)');xlabel('Normalised frequency');

    ylabel('Gain-db');

    case 2,% Impulse Invariance Method

    [n,wn]=buttord(wp,ws,r1,r2,'s');

    [z,p,k]=buttap(n);[num,den]=zp2tf(z,p,k);[numt,dent] = lp2lp(num,den,wn);

    [bz,az]=impinvar(numt,dent,1);[h,w]=freqz(bz,az,512);

    plot(w/pi,20*log10(abs(h)));grid;

    title('Butterworth lowpass filter(Impluse invariance)');xlabel('Normalised frequency');

    ylabel('Gain-db');

    end;

  • 7/30/2019 MPSRAVI DSPLAB

    32/65

    DSP LAB EEE

    Procedure:

    1. Open the MATLAB.

    2. Create a new file from file menu. Click new and select M-file.

    3. Type the relevant programs.

    4. Save the file.

    5. Run the program by using icon (or) select debug and selectRun (or) press F5.

    6. If any error present in the program, it will be displayed in the

    command prompt >> .

    7. To check the errors and rectify that errors in the program againrun the program.

    8. If no error occurs, the output waveform will be obtained.

    9. Print the output

  • 7/30/2019 MPSRAVI DSPLAB

    33/65

    DSP LAB EEE

    Viva -voice

    Result:

  • 7/30/2019 MPSRAVI DSPLAB

    34/65

    DSP LAB EEE

    Ex. No. : 8 DESIGN AND ANALYSIS OF FIR FILTER USING

    WINDOWSDate:

    Aim:To write a MATLAB program to design a FIR filter by usingWindowing techniques.

    Hardware/software requirement:

    S.NO Hardware/software

    1 PC with XP operating system.

    2 Matlab 2007b

    Algorithm:

    1. Get the order of the filter2. Get the coefficients of the filter3. Calculate frequency response by using window functions4. Plot the frequency response

    Program:

    %Program For Designing FIR Filter Using Windowing Techniques

    N=input('Enter the order of the filter :');Wc=input ('Enter the coefficients of the filter:');

    r=fir1(N,Wc,boxcar(N+1));figure (1);

    [h,o]=freqz(r,1,N);subplot(2,2,1);

    plot(o/pi,abs(h));grid;

    title('Rectangular Windowing Technique');xlabel('Normalised Frequency');

    ylabel('Magnitude');subplot(2,2,2);

  • 7/30/2019 MPSRAVI DSPLAB

    35/65

    DSP LAB EEE

    plot(o/pi,20*log(abs(h)));grid;

    xlabel('Normalised frequency');ylabel('Magnitude');

    x=fir1(N,Wc,hamming(N+1));

    figure (2);[h,o]=freqz(x,1,N);

    subplot(2,2,1);plot(o/pi, 20*log10(abs(h)));grid;

    title('Hamming windowing technique');xlabel('Normalised frequency');

    ylabel('Magnitude');

    subplot(2,2,2);plot(o/pi,20*log(abs(h)));grid;

    xlabel('Normalised frequency');ylabel('Magnitude');

    y=fir1(N,Wc,hanning(N+1));

    figure (3);[h,o]=freqz(y,1,N);

    subplot(2,2,1);plot(o/pi,abs(h));grid;

    title('hanning windowing technique');xlabel('normalised frequency');

    ylabel('magnitude');subplot(2,2,2);

    plot(o/pi,20*log(abs(h)));grid;

    xlabel('normalised frequency');

    ylabel('magnitude');

  • 7/30/2019 MPSRAVI DSPLAB

    36/65

    DSP LAB EEE

    Procedure:

    1. Open the MATLAB.

    2. Create a new file from file menu. Click new and select M-file.

    3. Type the relevant programs.

    4. Save the file.

    5. Run the program by using icon (or) select debug and selectRun (or) press F5.

    6. If any error present in the program, it will be displayed in thecommand prompt >> .

    7. To check the errors and rectify that errors in the program againrun the program.

    8. If no error occurs, the output waveform will be obtained.

    9. Print the output

  • 7/30/2019 MPSRAVI DSPLAB

    37/65

    DSP LAB EEE

    Viva voice:

    Result:

  • 7/30/2019 MPSRAVI DSPLAB

    38/65

    DSP LAB EEE

    EXPERIMENTS USINGDSP PROCESSOR TMS320C5X

    Exp No: 1

    Date : _ _ / _ _ / _ _

    GENERATION OF SIGNALS

    Aim:To write a program for generation of various input signals & verify by

    using DSP processor kit (TMS320C5X).

    Equipments Required:

    1. TMS320C5X - 12. CRO - 13. DAC - 14. Function Generator - 1

    PROGRAM (Sine Waveform Generation)

    TXD .SET 0HSTS .SET 1HDATA .SET 2H

    TEMP .SET 3HB3 .SET 0F000H

    B2 .SET 0F00HB1 .SET 00F0HB0 .SET 000FH

    .mmregs

    .text

    START:LDP #100HLACC #TABLE

    SACL TEMPREP1:

    LACC #TABLESACL TEMPLAR AR0,#372

    REP:

  • 7/30/2019 MPSRAVI DSPLAB

    39/65

    DSP LAB EEE

    LACC TEMPTBLR DATA

    OUT DATA,04H

    LACC TEMPADD #1H

    SACL TEMPMAR *,AR0BANZ REP,*-

    B REP1HLT: B HLT

    PROGRAM (Cosine Waveform Generation):

    .mmregs.text

    start:

    ldp #100hlacc #0fffh ;change this value for amplitude.

    loop: sacl 0rpt #0ffh ;change this value for frequency.out 0,04H ;address for dac.

    cmplb loop

    .end

    PROGRAM (Triangular Waveform Generation):

    .mmregs.text

    START:LDP #100H

    REP:

    SPLK #0,DATALAR AR0,#60

    REPH:OUT DATA,04H

    LACC DATAADD #40H

    SACL DATABANZ REPH,*-

  • 7/30/2019 MPSRAVI DSPLAB

    40/65

    DSP LAB EEE

    LAR AR0,#60

    REPL:OUT DATA,04H

    LACC DATASUB #40H

    SACL DATAMAR *,AR0BANZ REPL,*-

    B REP

    HLT: B HLT

    Procedure:

    1. Connect the Interface Card AD12N to TMS320C5X.2. Enter the Program & Execute.3. Observe the output at DAC using CRO.4.Plot the Waveform

  • 7/30/2019 MPSRAVI DSPLAB

    41/65

    DSP LAB EEE

    Viva voice

    Result:

  • 7/30/2019 MPSRAVI DSPLAB

    42/65

    DSP LAB EEE

    Exp No: 2

    Date : _ _/_ _/_ _

    LINEAR CONVOLUTION

    Aim:

    To write a program linear convolution and verify by using DSP processor kit(TMS320C5X).

    Equipments Required:

    1. TMS320C5X - 12. DAC - 1

    Procedure:

    1. Connect the Interface Card AD12N to TMS320C5X.2. Enter the Program & Execute.

    3. Observe the output using PC.

  • 7/30/2019 MPSRAVI DSPLAB

    43/65

    DSP LAB EEE

    PROGRAM FOR LINEAR CONVOLUTION

    .mmregs

    .text

    START:LDP #02H

    LAR AR1,#8100H ; x(n) dataslar ar0,#08200H ;h(n) datasLAR AR3,#8300H ;y(n) starting

    LAR AR4,#0007 ;N1+N2-1;to fold the h(n) values

    ;************************lar ar0,#8203H ; data mem 8200 to program mem c100(tblw)lacc #0c100h

    mar *,ar0

    rpt #3tblw *- ;to move 8203- 8200 to c100- c103

    ;padding of zerros for x(n) values;**********************************

    lar ar6,#8104hmar *,ar6

    lacc #0hrpt #3hsacl *+

    ;convalution operation starts;******************************

    LOP: MAR *,AR1LACC *+SACL 050H ;starting of the scope of multiplication

    LAR AR2,#0153H ; end of the array, to be multiplied with h(n) {150+N1-1}MAR *,AR2

    ZAPRPT #03H ;N1-1 times so that N1 timesMACD 0C100H,*-

    APAC ;to accmulate the final product sampleMAR *,AR3

    SACL *+

    MAR *,AR4BANZ LOP,*-

    H: B H

  • 7/30/2019 MPSRAVI DSPLAB

    44/65

    DSP LAB EEE

    INPUT ( x(n) )

    ;8100 - 1;8101 - 3;8102 - 1

    ;8103 - 3

    INPUT ( h(n) )

    ; 8200 - 0

    ; 8201 - 1; 8202 - 2

    ; 8203 - 1

    OUTPUT ( y(n) )

    ; 8300 - 1; 8301 - 5; 8302 - 8; 8303 - 8

    ; 8304 - 7; 8305 - 3

    ; 8306 - 0

    Result

  • 7/30/2019 MPSRAVI DSPLAB

    45/65

    DSP LAB EEE

    Exp No: 3

    Date : _ _/_ _/_ _

    IMPLEMENTATION OF A FIR FILTER

    Aim:To write a program implementation of FIR Filter and verify by using

    DSP processor kit (TMS320C5X).

    i) FIR Low Pass Filterii) FIR High Pass Filteriii) FIR Band Pass Filteriv) FIR Band Reject Filter

    Equipments Required:

    1. TMS320C5X - 12. CRO - 13. DAC - 14. Function Generator - 1

    Procedure:

    1. Connect the Interface Card AD12N to TMS320C5X.2. Enter the Program & Execute.3. Observe the output at DAC using CRO.4. Plot the Waveform.

  • 7/30/2019 MPSRAVI DSPLAB

    46/65

    DSP LAB EEE

    i) PROGRAMLOWPASS FILTER

    START:

    MAR *,AR0LAR AR0,#0200HRPT #33H

    BLKP CTABLE,*+SETC CNF

    * Input data and perform convolutionISR: LDP #0AH

    LACC #0

    SACL 0OUT 0,05 ;pulse to find sampling frequency

    IN 0,06HLAR AR7,#0 ;change value to modify sampling freq.MAR *,AR7

    BACK: BANZ BACK,*-IN 0,4

    NOPNOPNOP

    NOPMAR *,AR1

    LAR AR1,#0300HLACC 0AND #0FFFH

    SUB #800HSACL *

    LAR AR1,#333HMPY #0ZAC

    RPT #33HMACD 0FF00H,*-

    APACLAR AR1,#0300HSACH * ;give as sach *,1 incase of overflow

    LACC *

    ADD #800hSACL *OUT *,4LACC #0FFH

    SACL 0OUT 0,05

    NOPB ISR.end

  • 7/30/2019 MPSRAVI DSPLAB

    47/65

    DSP LAB EEE

    ii) PROGRAMHIGH PASS FILTER

    START:

    MAR *,AR0LAR AR0,#0200HRPT #33H

    BLKP CTABLE,*+SETC CNF

    * Input data and perform convolutionISR: LDP #0AH

    LACC #0

    SACL 0OUT 0,05 ;pulse to find sampling frequency

    IN 0,06HLAR AR7,#0 ;change value to modify sampling freq.MAR *,AR7

    BACK: BANZ BACK,*-IN 0,4

    NOPNOPNOP

    NOPMAR *,AR1

    LAR AR1,#0300HLACC 0AND #0FFFH

    SUB #800HSACL *

    LAR AR1,#333HMPY #0ZAC

    RPT #33HMACD 0FF00H,*-

    APACLAR AR1,#0300HSACH * ;give as sach *,1 incase of overflow

    LACC *

    ADD #800HSACL *OUT *,4LACC #0FFH

    SACL 0OUT 0,05

    NOPB ISR

  • 7/30/2019 MPSRAVI DSPLAB

    48/65

    DSP LAB EEE

    .end

    iii) PROGRAMBAND PASS FILTER

    START:

    MAR *,AR0LAR AR0,#0200H

    RPT #33HBLKP CTABLE,*+SETC CNF

    * Input data and perform convolutionISR: LDP #0AH

    LACC #0SACL 0OUT 0,05 ;pulse to find sampling frequency

    IN 0,06H

    LAR AR7,#0 ;change value to modify sampling freq.MAR *,AR7

    BACK: BANZ BACK,*-IN 0,4

    NOPNOP

    NOPNOPMAR *,AR1

    LAR AR1,#0300HLACC 0

    AND #0FFFHSUB #800HSACL *

    LAR AR1,#333HMPY #0

    ZACRPT #33HMACD 0FF00H,*-

    APACLAR AR1,#0300H

    SACH * ;give as sach *,1 incase of overflow

    LACC *ADD #800H

    SACL *OUT *,4

    LACC #0FFHSACL 0OUT 0,05

    NOPB ISR

  • 7/30/2019 MPSRAVI DSPLAB

    49/65

    DSP LAB EEE

    .end

    IV)PROGRAM BAND REJECT FILTER

    START:MAR *,AR0LAR AR0,#0200H

    RPT #33HBLKP CTABLE,*+

    SETC CNF* Input data and perform convolutionISR: LDP #0AH

    LACC #0SACL 0

    OUT 0,05 ;pulse to find sampling frequencyIN 0,06HLAR AR7,#0 ;change value to modify sampling freq.

    MAR *,AR7BACK: BANZ BACK,*-

    IN 0,4NOPNOP

    NOPNOP

    MAR *,AR1LAR AR1,#0300HLACC 0

    AND #0FFFHSUB #800H

    SACL *LAR AR1,#333HMPY #0

    ZACRPT #33H

    MACD 0FF00H,*-APACLAR AR1,#0300H

    SACH * ;give as sach *,1 incase of overflow

    LACC *ADD #800HSACL *OUT *,4

    LACC #0FFHSACL 0

    OUT 0,05NOPB ISR

  • 7/30/2019 MPSRAVI DSPLAB

    50/65

    DSP LAB EEE

    .end

    VIVA QUESTION:

    RESULT:

  • 7/30/2019 MPSRAVI DSPLAB

    51/65

    DSP LAB EEE

    Exp No: 4

    Date : _ _/_ _/_ _

    IMPLEMENTATION OF IIR FILTER

    Aim:To write a program implementation of IIR Filter and verify by using

    DSP processor kit.i) IIR Low Pass Filterii) IIR High Pass Filteriii) IIR Band Pass Filteriv) IIR Band Reject Filter

    Equipments Required:

    1. TMS320C5X - 12. CRO - 13. DAC - 14. Function Generator - 1

    Procedure:

    1. Connect the Interface Card AD12N to TMS320C5X.2. Enter the Program & Execute.3. Observe the output at DAC using CRO.4. Plot the Waveform.

  • 7/30/2019 MPSRAVI DSPLAB

    52/65

    DSP LAB EEE

    i) PROGRAMIIR LOW PASS FILTER

    .MMREGS

    .TEXT

    TEMP .SET 0INPUT .SET 1

    T1 .SET 2T2 .SET 3

    T3 .SET 4;K .SET 315eh

    M .SET 4e9fh

    ; a = 2 * (355/113) * 1000 = 6283.18/1000 = 6.28 ;; divide by 1000 for secs; K = aT/(1+aT) = 6.28*0.1 / (6.28*0.1+1) = 0.3857

    ; M = 1/(1+aT) = 1 / (6.28*0.1+1) = 0.61425;convert to Q15 format; K = K * 32767 = 12638.23 = 315Eh

    ; M = M * 32767 = 20127.12 = 4E9Fh

    ;Sampling Rate is 100 s & Cut off Frequency is 1 Khz

    LDP #100H

    LACC #0SACL T1SACL T2

    SACL TEMPOUT TEMP,4 ;CLEAR DAC BEFORE START TO WORK

    LOOP:

    LACC #0SACL TEMP

    OUT TEMP,5 ;OUTPUT LOW TO DAC2 TO CALCULATE TIMING;

    IN TEMP,06 ;SOC

    ;LAR AR7,#30h ;CHANGE VALUE TO MODIFY SAMPLING FREQ.

    ;sampling rate 100 s.

    MAR *,AR7BACK: BANZ BACK,*-

    ;IN INPUT,4 ;INPUT DATA FROM ADC1

    NOPNOP

    ;

    LACC INPUTAND #0FFFH

  • 7/30/2019 MPSRAVI DSPLAB

    53/65

    DSP LAB EEE

    SUB #800hSACL INPUT

    ;LT INPUTMPY #K

    PACSACH T1,1

    LT T2 ;PREVIOUS RESULT IN T2MPY #M

    PACSACH T3 ,1

    LACC T1ADD T3

    SACL T2

    ADD #800hSACL TEMPOUT TEMP,4 ;OUTPUT FILTER DATA TO DAC1

    ;

    LACC #0FFHSACL TEMP

    OUT TEMP,5 ;OUTPUT HIGH TO DAC2 TO CALCULATE TIMING;

    B LOOP

  • 7/30/2019 MPSRAVI DSPLAB

    54/65

    DSP LAB EEE

    ii) PROGRAMIIR HIGH PASS FILTER.MMREGS

    .TEXTSTART:

    LDP #100HLACC #00H

    SACL 00HSACL 01HSACL 02H

    SACL 03HSACL 04H

    SACL 05HLOOP:

    LACC #00H

    SACL 00H

    IN 0,06HLAR AR7,#30HMAR *,AR7

    BACK: BANZ BACK,*-

    ; LT 01H; MPY #0FFFFB5DEH

    ; PAC; SACH 05H,1

    IN 0,04H

    NOPSNOPNOP

    NOPLT 01H

    ; MPY #0FFFFB5DEHMPY #4A22H

    ; MPY #315EH

    PACSACH 05H,1

    LACC 00H

    AND #0FFFHXOR #800H

    SUB #800HSACL 00HSACL 01H

    ZAP

  • 7/30/2019 MPSRAVI DSPLAB

    55/65

    DSP LAB EEE

    LT 00H; DMOV 00H

    ; LTD 00HMPY #4A22H

    ; MPY #315EH

    PACSACH 02H,1

    LT 03HMPY #1446H

    ; MPY #4E9FHPAC

    SACH 04H,1LACC 02HADD 04H

    SUB 05H

    SACL 03HADD #800HSACL 00H

    ; OUT 00H,1AHOUT 0,04H

    B LOOPNOPNOP

    H: B H

  • 7/30/2019 MPSRAVI DSPLAB

    56/65

    DSP LAB EEE

    iii) PROGRAMIIR BAND PASS FILTER

    .MMREGS.TEXT

    START:LDP #100H

    LACC #00HLAR AR0,#00FFHLAR AR1,#8000H

    MAR *,AR1LOOP:

    SACL *+,AR0BANZ LOOP,AR1

    LOOP1:

    LACC #00HSACL 00HIN 0,06HLAR AR7,#30H

    MAR *,AR7BACK: BANZ BACK,*-

    IN 0,04HNOPNOP

    NOPNOP

    LT 04HMPY #003BH

    PAC; SACH 24H,0

    ; RPT #0BH; SFR

    SACH 24H,4

    LT 03H

    MPY #0000HPAC

    RPT #0BH; SFR

    ; SACH 23H,0SACH 23H,4

    LT 02HMPY #0077H

  • 7/30/2019 MPSRAVI DSPLAB

    57/65

    DSP LAB EEE

    PAC; RPT #0BH

    ; SFR; SACH 22H,0

    SACH 22H,4

    LT 01HMPY #0000HPAC

    ; RPT #0BH; SFR

    ; SACH 21H,0SACH 21H,4

    LACC 03H

    SACL 04HLACC 02HSACL 03HLACC 01H

    LACC 02H

    LACC 00HAND #0FFFHXOR #800H

    SUB #800HSACL 00H

    SACL 01HZAP

    LT 00H

    MPY #003BHPAC

    ; RPT #0BH

    ; SFR; SACH 20H,0

    SACH 20H,4

    LT 73H

    MPY #0B04HPAC

    ; RPT #0BH; SFR; SACH 63H,0

    SACH 63H,4

  • 7/30/2019 MPSRAVI DSPLAB

    58/65

    DSP LAB EEE

    LT 72HMPY #1226H

    PAC; RPT #0BH; SFR

    ; SACH 62H,0SACH 62H,4

    LT 71HMPY #21A3H

    PAC; RPT #0BH

    ; SFR; SACH 61H,0

    SACH 61H,4

    LACC 72H

    SACL 73HLACC 71HSACL 72HLACC 70H

    SACL 71HLT 70H

    MPY #15E9HPAC

    ; RPT #0BH

    ; SFR; SACH 60H,0

    SACH 60H,4

    LACC 20H

    ADD 21HSUB 22H

    ADD 23HADD 24H

    ADD 60HSUB 61H

    ADD 62H

    SUB 63H

    SACL 70HADD #800H

    SACL 00H; OUT 00H,1AH

    OUT 0,04H

    B LOOP1NOP

  • 7/30/2019 MPSRAVI DSPLAB

    59/65

    DSP LAB EEE

    NOPH: B H

    iv) PROGRAMIIR BAND REJECT FILTER

    .MMREGS

    .TEXT

    START:LDP #100H

    NOPNOPNOP

    LACC #00H

    LAR AR0,#00FFHLAR AR1,#8000HMAR *,AR1

    LOOP:

    SACL *+,AR0BANZ LOOP,AR1

    LOOP1:LACC #00H

    SACL 00HIN 0,06H

    LAR AR7,#30HMAR *,AR7

    BACK: BANZ BACK,*-

    IN 0,04HNOP

    NOPNOPNOP

    LT 04H

    MPY #2FC4H

    ; MPY #05F8HPAC

    SACH 24H,0; SACH 24H,4

    LT 03HMPY #99B2H

    ; MPY #1336HPAC

  • 7/30/2019 MPSRAVI DSPLAB

    60/65

    DSP LAB EEE

    SACH 23H,0; SACH 23H,4

    LT 02HMPY #0DB29H

    ; MPY #1B65H

    PACSACH 22H,0

    ; SACH 22H,4

    LT 01H

    MPY #99B2H; MPY #1336H

    PACSACH 21H,0

    ; SACH 21H,4

    LACC 03H

    SACL 04HLACC 02HSACL 03HLACC 01H

    LACC 02HLACC 00H

    AND #0FFFHXOR #800HSUB #800H

    SACL 00HSACL 01H

    ZAP

    ; DMOV 03H

    ; DMOV 02H; DMOV 01H

    LT 00HMPY #2FC4H

    ; MPY #05F8H

    PACSACH 20H,0

    ; SACH 20H,4

    ;LT 73H

    MPY #2A22H; MPY #0544H

    PACSACH 63H,0

    ; SACH 63H,4

    LT 72HMPY #6761H

  • 7/30/2019 MPSRAVI DSPLAB

    61/65

    DSP LAB EEE

    ; MPY #0CECHPAC

    SACH 62H,0; SACH 62H,4

    LT 71HMPY #0B6E8H

    ; MPY #16DDH

    PACSACH 61H,0

    ; SACH 61H,4

    LACC 72H

    SACL 73H

    LACC 71HSACL 72HLACC 70HSACL 71H

    Result

  • 7/30/2019 MPSRAVI DSPLAB

    62/65

    DSP LAB EEE

    Exp No: 5

    Date : _ _/_ _/_ _

    CALCULATION OF FFT

    Aim:

    To write a program for calculation of FFT and verify by using DSPprocessor kit (TMS320C5X).

    Equipments Required:

    1. TMS320C5X - 12. DAC - 1

    Procedure:

    1. Connect the Interface Card AD12N to TMS320C5X.2. Enter the Program & Execute.3. Observe the output using PC.

  • 7/30/2019 MPSRAVI DSPLAB

    63/65

    DSP LAB EEE

    PROGRAM CALCULATION OF FFT

    .mmregs

    .textSTART:

    LDP #100H; LACC N

    SPLK #8H,N

    CALL 0B000H ;call the subroutine for bitreversing the inputLAR AR0,#BIT_REV ;transfer the bitrevesed data in 8020 to 8030

    LAR AR5,#INPLACE ;and include the imaginary partCALL 0B100H ;call the subroutine for this purposeSPLK #3H,STG ;for 8 point FFT 3 stages are found

    SPLK #1H,BFLY ;for first stage butterfly=1

    SPLK #2H,DNS ;dual node spacing=2SPLK #2H,0FHZAPLT 0FH ;8 real values & 8 imaginary values for each stage

    MPY NSPL 2H

    LT 2HMPY STG ;location 8002 hold the number of tableSPL 2H ;values or twidle factor values

    LAR AR1,#TWIDLE

    MAR *,AR1RPT 2HBLPD #TABLE,*+ ;transfer the twidle factor values from program

    ;memory to the data memory(8090)

    LAR AR1,#TWIDLELACC STGSUB #1H ;stage value is subtracted by 1 for counter

    SACL STGC ;purposeLACC 00

    SACL GRP ;let group=8

    LAR AR7,STGC ;stage loopSTGLOP LACC GRP ;group=group/2

    BSAR 1HSACL GRP

    SUB #1H ;group value is subtracted by 1 for counterSACL GRPC ;purposeLAR AR6,GRPC ;group loop

    LACC BFLYSUB #1H

  • 7/30/2019 MPSRAVI DSPLAB

    64/65

    DSP LAB EEE

    SACL BFLYCLACC DNS ;dual node spacing value is subtracted by 1

    SUB #1H ;for counter purposeSACL DNSC

    ;this is the main butterfly loopLAR AR0,#INPLACE ;take the input values from 8030

    GRPLOP LAR AR2,BFLYC ;butterfly counterBFLYLOP CALL 0B200H ;call the subroutine for the complex

    ;multiplication of input values and twidle

    ;factor values

    MAR *,AR0 ;incrment the location 8030 for next complex

    RPT DNSC ;multiplication(for example in first stage

    LACC *+ ;location is incremented from 8030 to 8032)CALL 0B200H ;gain call the subroutineMAR *,AR0RPT DNSC

    LACC *-CALL 0B300H ;call the subroutine for comlex addition

    ;and complex subtraction

    MAR *,AR0

    RPT DNSC ;increment the 8030 location for next butterflyLACC *+MAR *,AR2

    BANZ BFLYLOP,*- ;decrement the butterfly & checkMAR *,AR0

    RPT DNSCLACC *+ ;increment the 8030 location for nextMAR *,AR6 ;group

    BANZ GRPLOP,*- ;decrement the group & checkLT BFLY ;increase the butterfly for next stage

    MPY #2H

    SPL BFLYLT DNS ;increase the dual node spacing for

    MPY #2H ;next stageSPL DNS

    MAR *,AR7BANZ STGLOP,*- ;decrement the stage & check

    HLT: B HLT

  • 7/30/2019 MPSRAVI DSPLAB

    65/65

    DSP LAB EEE

    INPUT .set 8010H ;inputs are given in 8010BIT_REV .set 8020H ;bitreversed input are found in 8020

    INPLACE .set 8030H ;final outputs are in 8030TWIDLE .set 8090H ;twidle factor values are in 8090

    N .set 0HSTG .set 1HSTGC .set 3H

    GRP .set 4HGRPC .set 5H

    BFLY .set 6HBFLYC .set 7HDNS .set 8H

    DNSC .set 9H

    R lt