Hi,
I want to Generate pure tone from 1kHz to 8kHz Signal Using MONO-Codec IC
How does this fit to:
Required frquency : 250Hz, 500Hz, 1kHz, 2kHz,...
I´d like to add the word "phase" here:
You'll increment the look-up table address with fixed 44.1 kHz, but use different phase increments to achieve different sine frequencies.
Example:
If you want to generate 1kHz and you have a sample clock of 44.1kHz.
Obviously you need 44.1 samples for one full wave.
Since one full wave is 360° --> you neeed a phase increment of 360° x 1kHz / 44.1kHz = 8,163°.
Use a phase counter with range of 0...360°, but with fractionals. maybe a 16 bit unsigned integer with 9 bits integer and 7 bits fractional.
0biiii iiii ifff ffff
use a phase increment value with same 9 bits integer and 7 bits fractional.
for a phase increment use:
0b 0000 0010 0001 0101 (this is closest to 8.163°)
This results in an output frequency of 1000.0977Hz
after adding phase increment:
* when carry flag is set: subtract 360°
* when value >=360° then subtract 360°
You may set any frequency in step size of 0.957Hz
Now you have phase information value 0...360°.
Calculate what table entry to use.
Either select the closest one or do interpolation.
Then output this value to the DAC.
You may use Excel to simulate all this.
Klaus