1 | #ifndef DDS_H_
|
2 | #define DDS_H_
|
3 |
|
4 | /// <summary>
|
5 | /// Author: Florian Asal
|
6 | /// Date: 2012.10.17
|
7 | ///
|
8 | /// Using an adc speed of 48000Hz, which means that we can output 48000 values per second. To save storage
|
9 | /// The output buffer is defined with a size of 960. Therefore we have to call the function 50 times a second
|
10 | /// 48000/960 = 50 So using the DDS-Method with a frequency of 100, we are going to get 2 sine oscillations in
|
11 | /// the output buffer. Multiplied by 50 = 100 waves per second => 100Hz.
|
12 | ///
|
13 | /// While using this configuration (48000/960), a minimum LUT_SIZE of 120 is required, so that at 100Hz only one value
|
14 | /// has to be interpolated between the samples:
|
15 | /// frequency tuning word >= 0.5 => LUT_SIZE = jumpSize * F_CLK / (2*f_min) = 0.5 * 48000 / 200 = 120
|
16 | /// </summary>
|
17 |
|
18 | /// <summary>
|
19 | /// Size of the LUT for the sine
|
20 | /// Requirement: at minimum frequency at maximum one sample value is allowed be interpolated
|
21 | /// between the samples of the harmonic oscillation stored in the table.
|
22 | /// => frequency tuning word >= 0.5 => LUT_SIZE = jumpSize * F_CLK / (2*f_min) = 0.5 * 48000 / 200 = 120
|
23 | /// </summary>
|
24 | #define LUT_SIZE 120
|
25 |
|
26 | /// <summary>
|
27 | /// Size of the output buffer
|
28 | /// </summary>
|
29 | #define OUT_SIZE 960
|
30 |
|
31 | /// <summary>
|
32 | /// ADC-speed - according to shannon, this frequency has to be twice as big as the maximum output frequency
|
33 | /// </summary>
|
34 | #define F_CLK 48000
|
35 |
|
36 | //Prototypes
|
37 | void DDS_init(void);
|
38 | void DDS(Int16 *, double, Int16);
|
39 | double Lanczos(double);
|
40 |
|
41 | #endif
|