Sinusoidal signals are commonly used in signal processing applications and generating these waveforms provides an interesting project that is the focus of this recipe. A common approach is a direct method that stores the sinusoidal waveform samples in a look-up-table (LUT). This recipe is called dacSinusoid_c5v0
.
First, we need to calculate the (12-bit) DAC values that will be stored in the LUT. We'll attempt to generate a 50 Hz sinusoidal signal and use a spreadsheet (for example, Microsoft Excel) to calculate the following values:
Smpl. No |
Theta Rads |
floor((sin(theta)+1)*4095/2) |
---|---|---|
0 |
0 |
2047 |
1 |
0.31415927 |
2680 |
2 |
0.62831853 |
3250 |
3 |
0.9424778 |
3703 |
4 |
1.25663706 |
3994 |
5 |
1.57079633 |
4095 |
6 |
1.88495559 |
3994 |
7 |
2.19911486 |
3703 |
8 |
2.51327412 |
3250 |
9 |
2.82743339 |
2680 |
10 |
3.14159265 |
2047 |
11 |
3.45575192 |
1414 |
12 |
3.76991118 |
844 |
13 |
4.08407045 |
391 |
14 |
4.39822972 |
100 |
15 |
4.71238898 |
0 |
16 |
5.02654825 |
100 |
17 |
5.34070751 |
391 |
18 |
5.65486678... |