Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Fixed-point cosine generation

Status
Not open for further replies.

siyom

Member
how do i generate a cosine wave in a fixed point processor?
or more easily,how do I convert a sine wave generated this way into a cosine wave?sine wave elements are in an array
 
Well that's too easy mate.the sine elements are in an array form,so you cannot really just subtract 90 from them....could work thou,let me try it out
 
Last edited:
If you can show the code it could be useful.

Subtracting 90 from the array elements isn't what you want to do, you should subtract the lookup value from 90 and use that

so if you have an array sin[x], then to get the cosine you just use sin[90-x]
 
I wanna use this for a phase locked loop.all algorithms I know numbers need to be in floating point arithmetic.dealing with a sine wave in this form is tidious
 
I wanna use this for a phase locked loop.all algorithms I know numbers need to be in floating point arithmetic.dealing with a sine wave in this form is tidious

The CORDIC algorithm I linked you to was specifically written to be implemented using only integer arithmetic, even without a hardware multiply.
 
Depends on the accuracy of your sine wave.... I use a small 30 point integer lookup table to generate cosine and sine... A 15 point integer lookup to generate tangent.... I get pretty good results with about 0.2 degrees precision...
 
I generate a look up table,then if I want to implement a phase locked loop how do I keep track of the phase?I know that I need to minise the phase error for correct demodulation,but if my sine signals are in an buffer array how do I work with them?
For example,an FM signal comes in,I multiply by my VCO signal,then I filter out the upper side bands and left with the error signal multiplied by the message signal as:

y(t) = cosE*m(t)

but now if my signal is stored in some buffer array,how do I track the phase?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top