Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Programmable sine wave algorithms for SHARC DSPs

Status
Not open for further replies.

kirgizz

Member level 2
Joined
Sep 7, 2004
Messages
52
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
644
sharc efficient biquad

Hello,

does anyone have any EFFICIENT assembly CODE to produce sine/cosine waves for the ADSP-212xx? I need to produce a programmable sin/cos oscillator with 1Hz (prefer 0.1Hz) resolution between 100Hz and 20KHz.

I used a sine approximation algorithm (using sine table) from Motorola DSP56k example. Becasue of different memory organization and functionality (between DSP56k and AD SHARC DSPs) its implementing is not possible now.

Thanks
 

sharc adi pi

Try to find the ADI's document ,there is some document for that..
 

Hi, you can use this algorithm in an infinite loop:

{
out [n] = A * v1;
tmp = v1;
v1 = coeff * v1 - v2;
v2 = tmp;
}

out[n] is your output sample.

initial conditions:
0 ≤ startphase ≤ 2 * pi
Fs = sampling frequency
frequency = (2 * pi * frequency you want) / (Fs)
coeff = 2 * cos(frequency)
v1 = sin(startphase)
v2 = sin( -1 * frequency + startphase)
A is amplitude of the signal

I've tested this algorithm from 50 hz to 16 khz and works very well , with less distortion that the "table read" one. The shift in frequency is a function of the word length of the DSP you use.

Regards.
 

Hi all,

thank you for suggestions.

I found some pieces of code in ADI examples. But nothing like sine approximation
using sine table. Of course, I can use Taylor series to generate sine oscillations, but
it takes a bigger number of cycles (especial for a good precision).

to catilo

The algorithm is good and understandable. The only thing is where I get sin()-function in assembly?

Regards
 

to catilo
OK. I think I understand it completely now. The algorithm seems to work but needs some optimizations.

And a general question: it is a better choice to implement sine wave generator in fixed point? Can anyone suggest a quick algorithm with high precision?


thanks in advance
 

Hi,

the problem is that I design a fixed point biquad sine oscillator.
The start angles vary according to this from 0 to 1 rad.

Does anybody have a solution?
 

Hi,

I'm glad to report that the oscillator is working (very) well. I need sine and cosine (coexistent) together, that's why I implemented the biquad coupled sine oscillator.

The only problem is initializing sine AND cosine.
The osillator frequency should be set (or chosen) by user at program run-time. So I used Taylor series approximation for calculating start values, but it's precision here is different for sine and cosine.
Secondly, there is an another problem while using fixed point data: start angle (or delta) must be <1. I tried to use formulas like sin(x)=sin(180-x) and cos(x)=-cos(180-x) plus angle addition formulas for 45 degrees angles. I think init values calculation lost more precision after using it.

Does anyone have another idea for init calculation?

Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top