Sine wave lookup table

Status
Not open for further replies.

Rockzinstruz

Junior Member level 2
Joined
Jan 21, 2012
Messages
21
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,425
Hi all...

If anybody have the sine wave 8-bit look table ..Please give post here.



Thanks
 

Thanks for your response..
But I didn't get the conversion of sine degree to lookup table.
Please explain the calculation for one example value.
 

PHP:
double TABLE [180] ;
#define PI 3.14159265
void R_TABLE (void)
{
	for (double i = 0; i <=180; i = i+1)
	{
	 TABLE[(int)i] = sin(i * PI /180);	
	}
	
}
 

Can we use digital to analog converter DAC0800 instead of DAC 0808 in sine wave generation using 8051?
 
Yes, it has a better temperature range specification
 

Which one better choice DAC 0800 or DAC 0808...
 

https://www.mikrocontroller.net/articles/Digitale_Sinusfunktion

Here is the table:
https://www.mikrocontroller.net/topic/251921#2593000

it is for +/-127 amplitude

002 005 008 011 014 017 020 023
026 029 032 035 038 041 044 047
050 053 056 059 061 064 067 070
072 075 077 080 082 084 087 089
091 093 095 098 100 101 103 105
107 109 110 112 113 115 116 117
118 119 121 121 122 123 124 125
125 126 126 127 127 127 127 127

for double resultion:

3 9 16 22 28 34 41 47
53 59 65 71 77 83 89 95
100 106 112 117 123 128 134 139
144 149 154 159 164 169 174 178
183 187 191 195 199 203 207 210
214 217 220 223 226 229 232 234
237 239 241 243 245 247 248 249
251 252 253 253 254 255 255 255


Tip:

apply a FIR-Filter behind it
 
Last edited:

Ah, did not recognize, you wrote a complete piece of software for this.

ok, I got one question:

Did you take into account the centre issue, meaning to add an offset onto the phase off 0,5 dots in order to hit the middle of a covered area?

The problem of the digital sinewaves are usually that they have an even number of dots, like 16,32, 63 or so, and thus it is not easy to mirror them using just one quarter.

Counting is: 0,1,2,3,4,3,2,1 - but better was: 0,1,2,3,3,2,1,0

This requires the Y-values to represent the value in between 0 and 1 meaning Y=sin(PI * (k + 0,5)/k). I tried to describe this in the above linked article.

For C/C++ and larger speed grades of CPUs this is not a problem, but if you want to implement sine wave tables (or any other table similar) in PLDs or FPGAs, you can save one bit for the phase accumulator and also obtain the mirrored phase but just a bit negation. For example in a MAX2 device, a sine wave DDS at a given precision, could run at 220MHz instead or only 140, when used the classical way.
 

What's the benefit of adding the 0.5 offset? I've never seen it used in any PIC (or AVR) based application. What's the issue with not adding the 0.5 offset? I can't seem to understand the advantage of adding the offset or the disadvantage of not adding it.
 

The problem of the digital sinewaves are usually that they have an even number of dots
Counting is: 0,1,2,3,4,3,2,1 - but better was: 0,1,2,3,3,2,1,0
Try increasing the number of dots in table you will get symmetrical ones for Quarters
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…