DSPRelated.com
Forums

Help required

Started by dalvi kiran June 4, 2003
Hi all,
I am facing problems in simulating interrupts for
ADSP2184 in VisualDSP++. I have written service
routine, & i am forcing interrupt by using raise()
function. raise function is working properly, but
program is not taking interrupt routine.
What i am supposed to do ?
Does anybody have code for the same ?

Thanks in advance
Kiran

__________________________________




Folks,
I am trying to implement a low pass FIR filter in Visual DSP for the 2181
processor (Am very new to signal processing). I used the signal processing
toolbox in Matlab to generate coefficients of the required filter. (its a 844
order filter) and then exported these coefficients to a file and then read in
the coefficients in Visual DSP. The coefficients I obtained are in floating
point format and some in fixed point format. Can u tell me how to convert these
to the 1.15 point representation (the 16-bit representation with 1 sign bit and
the others 2^(-1), 2^(-2) ..2^(-15)). Do I do this conversion in Visual DSP or
in Matlab itself?
I have an 800-sample input signal which is a sum of two sinusoids. I need to
filter out one of the signals.
Thanks in advance,
Hans



If your coefficients are in decimal, (range + - 1) just put an "r" after each
number like this:
.00564856r
.00045751r
-.12545654r

The assembler converts them to 1.15. It took me hours to find that out.

Dave

David Tiefenbrunn N1WWY
Essential Telecommunications Corp. - http://www.essentialtel.com
David Tiefenbrunn - http://users.abac.com/dandatief
-----Original Message-----
From: [mailto:]
Sent: Wednesday, June 04, 2003 7:49 AM
To:
Subject: [adsp] coversion between data formats Folks,
I am trying to implement a low pass FIR filter in Visual DSP for the 2181
processor
[snip]

The coefficients I obtained are in floating
point format and some in fixed point format. Can u tell me how to convert these
to the 1.15 point representation



Hi,
As part of an assignment using ADSP2181 in Visual DSP, I am required to
create 2 sinusoids of different frequencies using a lookup table. Heres the
exact words "Write a macro that creates a sinusoid of amplitude A, lookup table
cycle c, with DAG pointer and address modifier as i/p parameters."
I generated the sinusoids using the "sin" function, but the lecturer prefers
creating it from a lookup table.
What does lookup table mean? and how do we generate a signal using that. Any
hints anyone?
Thanks,
Hans



Hi Dave,
Thanks for replying to my query. Yes, my coeffs are in decmal. I tried the
sugestion with something like " hz[0] = 0.2134r;", but the compiler comlains
abt the syntax. Clearly, it was expecting an ';' instead of the'r' at the end.
Do I have to set any other compiler options for this to work?
Without the 'r', if I just input the decimal (double), like say the
value '0.5', it gets stored in the dm as 3F00 0000. What format is this? In
1.15 format, I would expect 4000 0000.
Thanks,
Hans

Quoting Dave Tiefenbrunn <>:

> If your coefficients are in decimal, (range + - 1) just put an "r" after each
> number like this:
> .00564856r
> .00045751r
> -.12545654r
>
> The assembler converts them to 1.15. It took me hours to find that out.
>
> Dave
>
> David Tiefenbrunn N1WWY
> Essential Telecommunications Corp. - http://www.essentialtel.com
> David Tiefenbrunn - http://users.abac.com/dandatief >
> -----Original Message-----
> From: [mailto:]
> Sent: Wednesday, June 04, 2003 7:49 AM
> To:
> Subject: [adsp] coversion between data formats > Folks,
> I am trying to implement a low pass FIR filter in Visual DSP for the 2181
>
> processor
> [snip]
>
> The coefficients I obtained are in floating
> point format and some in fixed point format. Can u tell me how to convert
> these
> to the 1.15 point representation
>



Hi..its me again... :)
Another itsy bitsy doubt..i noticed that when a "double arra[]" was stored in
the data memory, each element of the array took up 4 bytes, but when stored in
the program memory, each element took up 6 bytes.
Heres the actual snippet of the test code and the corresponding memory dump:

double dm arr1[3] = {0.5, -0.5, 0.25};
arr1 (in data memory)
[000006] 3F00 0000 BF00
[000009] 0000 3E80 0000

double pm arr2[3] = {0.5, -0.5, 0.25};
arr2 (in program memory)
[0037BB] 3F0000 000000
[0037BD] BF0000 000000
[0037BF] 3E8000 000000

Is there a reason for this diffrence?

Thanks,
Hans Quoting :

> Hi Dave,
> Thanks for replying to my query. Yes, my coeffs are in decmal. I tried the
> sugestion with something like " hz[0] = 0.2134r;", but the compiler comlains
>
> abt the syntax. Clearly, it was expecting an ';' instead of the'r' at the
> end.
> Do I have to set any other compiler options for this to work?
> Without the 'r', if I just input the decimal (double), like say the
> value '0.5', it gets stored in the dm as 3F00 0000. What format is this? In
> 1.15 format, I would expect 4000 0000.
> Thanks,
> Hans
>
> Quoting Dave Tiefenbrunn <>:
>
> > If your coefficients are in decimal, (range + - 1) just put an "r" after
> each
> > number like this:
> > .00564856r
> > .00045751r
> > -.12545654r
> >
> > The assembler converts them to 1.15. It took me hours to find that out.
> >
> > Dave
> >
> > David Tiefenbrunn N1WWY
> > Essential Telecommunications Corp. - http://www.essentialtel.com
> > David Tiefenbrunn - http://users.abac.com/dandatief
> >
> >
> >
> > -----Original Message-----
> > From: [mailto:]
> > Sent: Wednesday, June 04, 2003 7:49 AM
> > To:
> > Subject: [adsp] coversion between data formats
> >
> >
> > Folks,
> > I am trying to implement a low pass FIR filter in Visual DSP for the
> 2181
> >
> > processor
> > [snip]
> >
> > The coefficients I obtained are in floating
> > point format and some in fixed point format. Can u tell me how to convert
> > these
> > to the 1.15 point representation
> >
>


>From:
>To: Dave Tiefenbrunn <>
>CC:
>Subject: RE: [adsp] coversion between data formats
>Date: Fri, 6 Jun 2003 20:44:45 +1200
>
>Hi Dave,
> Thanks for replying to my query. Yes, my coeffs are in decmal. I tried
>the
>sugestion with something like " hz[0] = 0.2134r;", but the compiler
>comlains
>abt the syntax. Clearly, it was expecting an ';' instead of the'r' at the
>end.
>Do I have to set any other compiler options for this to work?
> Without the 'r', if I just input the decimal (double), like say the
>value '0.5', it gets stored in the dm as 3F00 0000. What format is this? In
>1.15 format, I would expect 4000 0000.
>Thanks,
>

You will find something called EZForum for old 2181 EZ-Kit Lite on the ADI
web site. That contains a utility, TODAT.com, written by Dwight Elvey that
converts a file containing FP values into 1.15 format. Leon
--
Leon Heller, G1HSM Tel: +44 1424 423947
Email:
My web page: http://www.geocities.com/leon_heller

_________________________________________________________________
Sign-up for a FREE BT Broadband connection today!
http://www.msn.co.uk/specials/btbroadband


On Fri, 6 Jun 2003 wrote:

> Hi,
> As part of an assignment using ADSP2181 in Visual DSP, I am required to
> create 2 sinusoids of different frequencies using a lookup table. Heres the
> exact words "Write a macro that creates a sinusoid of amplitude A, lookup
table
> cycle c, with DAG pointer and address modifier as i/p parameters."
> I generated the sinusoids using the "sin" function, but the lecturer
prefers
> creating it from a lookup table.
> What does lookup table mean? and how do we generate a signal using that.
Any
> hints anyone?

You missed a day in class eh? A lookup table is just a list of values in
memory. You use the address as an input and the value you have stored
there is the output. It's really simple.

So for a sine table, say of 16 values you'd have

offset value
0 sin(0)
1 sin(pi/16)
2 sin(2*pi/16)
: :
15 sin(15*pi/16)

Which only gives half a sine wave (can you see why?)
Your prof wants you to build a table, and then use
indirect addressing to look up values in the table.
Use a circular DAG, and a full table, and you can
generate a sinisoid really easily.

Patience, persistence, truth,
Dr. mike


Hans wrote:

> Thanks for replying to my query. Yes, my coeffs are in decmal. I tried the
>sugestion with something like " hz[0] = 0.2134r;", but the compiler comlains
>abt the syntax.

Sorry, I didn't include all the details.

Define the variable like this:

#define Filterlength0;
.VAR/CIRC FilterCoeffents[FilterLength] = "Filter 100 taps.txt";

The coefficients are in the file "Filter 100 taps.txt" in the format:

.00215542r
.00045522r
...

An alternative is:

.VAR/CIRC FilterCoeffents[2] = .0001245r, -.0044452r;

Dave

David Tiefenbrunn N1WWY
Essential Telecommunications Corp. - http://www.essentialtel.com
David Tiefenbrunn - http://users.abac.com/dandatief