DSP BASED DIGITAL FUNCTION GENERATOR - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Tuesday, June 28, 2011

DSP BASED DIGITAL FUNCTION GENERATOR


DSP BASED DIGITAL FUNCTION GENERATOR

AIM:

To stimulate a simple pulse generator using ADSP2181 DSP processor

Apparatus REQUIRED:

1.      ADSP2181 unit
2.      ADSP 2181 Universal
3.      CRO
4.      IBM PC keyboard

Theory:

ADSP 2181 is highly advanced DSP processor, which works of on chip serial port. It is capable of processing 16-bit arithmetic operation, with ALU and Accumulator. This ADSP2181 is suitable for developing applications like adaptive filtering, FET & external precision arithmetic etc.,In this experiment a simple pulse generator is stimulated  using ADSP2181.
In order to develop this application IBM PC keyboard is connected to ADSP2181through the IO port of oxo2
The IBM PC keyboard up arrow is used to increase the amplitude of the pulse wave, down arrow is used to decrease the amplitude, left arrow is used to decrease the frequency and right arrow is used to increase the frequency.

Problem STATEMENT:

1.      using ADSP2181 generate the square wave and measure the amplitude of the square wave and frequency
2.      Identify scan codes for the up arrow , down arrow, right and left arrow by reading the IO port through which IBM PC keyboard is connected to the IO port of ADSP2181
3.      Find the suitable logic and wrote a program to increase and decrease the amplitude of square wave using CRO

FLOWCHART





sAMPLE PROGRAM:

.module /ram main _routine;
start:
            ay0 =0xfff; [max peak voltage]
beg:
            cntr =0xfff; [delay counter]
            do int until ce;
axo =0x0000;
int:       io(0x14) =ay0;[send max peak to DAC]
ax1=io(0x102);[read keyboard port]
dm(0x103) =ax1; [store the scan cade for the pressed key]
ay1 = 0x0ff; [max upper bytes]
ar=ax1 and ay1;
ax1=ar;
ay1=0x0075;[scan code for  up arrow key]
ar=ax1-ay1 ; [do camparision]
dm(0x105)=ar;
if ne jump beg;[if not equal repeat the same square wave]
ay =ay0+1;[if equal increase the max peak voltage repeat the square wave]
ay0=ar;
dm(0x106)=ay0;
jump beg;
idle;
.end mod;

EXERCISE:

In the given program pulse generator is stimulated only using up arrow key so the students instructed to stimulate the same using down arrow , left arrow & right arrow kkeys by identifying the key codes

Program:
.module /ram main_routine;
start:
            ay0  =0xfff;[max peak voltage]
            ax1  =0xff;
            dm(0x107)=ax1;
beg:     cntr =dm(0x107);[delay counter]
            do int until ce;
            ax0=0x0000;
int:       io(0x14) =ax0 ; [send minimum peak to DAC]
cntr =dm(0x107);
do  ict until ce;
            ict:       io(0x14)=ay0;[send maximum peak to DAC]
ax1=io(0x102); [read keyboard port]
                        dm(ox103)=ax1;[store scan code for pressed key]
                        ay1=ox0ff;
                        ar=ax1 and ay1;
                        ax1 =ar;
                        ay1=0x0075;[scan code for up arrow key]
ar=ax1 –ay1;[do comparision]
dm(0x105)=ar;
if ne jump aaa;[if not equal check for another key]
ar=ay0+1;[ increase amplitude]
ay0=ar;
dm(0x106)=ay0;
jump beg;
aaa:
            ay1=0x0072;[scan code for down arrow key]
ar=ax1-ay1;[do comparision]
dm(0x108)=ar;
if ne jump bbb;[if not equal check for another key]
ar=ay0-1;[ decrease amplitude]
ay0=ar;
dm(0x106)=ay0;
jump beg;
bbb:     ay1=0x0072;[scan code for right arrow key]
ar=ax1-ay1;[do comparision]
dm(0x109)=ar;
if ne jump ccc;[if not equal check for another key]
ax1=dm(0x107)
ar=ax1+5;[ decrease frequency]
dm(0x107)=ar;
jump beg;
ccc:      ay1=0x0074;[scan code for left arrow key]
ar=ax1-ay1;[do comparision]
dm(0x110)=ar;
if ne jump beg;[if not equal check for another key]
ax1=dm(0x107)
ar=ax1-5;[ increase frequency]
dm(0x107)=ar;
jump beg;
            idle;
            .end mod;







TABULATION COLUMN:







AMPLITUDE
( V)
TIME PERIOD
(MS)





SQUARE  WAVE







T ON



T OFF





MODEL   GRAPH :





RESULT:

Thus the square wave is generated using ADSP2181 DSP.















No comments:

Post a Comment