AD9833 Frequency Sweeping

Please check the frequently asked questions before posting to the forum.
Post Reply
Author
Message
sulochana
Posts: 1
Joined: 20 Dec 2016 07:24

AD9833 Frequency Sweeping

#1 Post by sulochana » 10 Jun 2017 07:10

Hi Everyone,

i am able to generate frequency in sine,square and triangle waveforms and also able to sweep frequency .But problem arised during sweeping frequency with step of 0.001 Hz.i am using freqreg0.

For Example:
Formula i used :
freq reg=(fout freq * 2^28)/25Mhz.

fout freq freq reg hex val
10.001 107.384919 6B
10.002 107.395657 6B
etc.....

wave.MSB =(int)( 0x4000 | (int)((freq_reg & 0xFFFC000) >> 14)); //Only lower 14 bits are used for data
wave.LSB =(int)( 0x4000 | (int)(freq_reg & 0x3FFF));

GPIOB_OFF_BIT(12); //chip select bit is OFF
delay(5000);
AD9833_write((wave.LSB )); // Write lower 16 bits to AD9833 registers
AD9833_write((wave.MSB )); // Write upper 16 bits to AD9833 registers.
AD9833_write(0xC000); // Phase register
AD9833_write(wave.waveform); // Exit & Reset to SINE, SQUARE or TRIANGLE
delay(5000);
GPIOB_ON_BIT(12);

By seeing example hope it understand .Problem is while freq reg value is converting to hex its considering only integer part but fraction part is ignoring.
so in this case 0.001 hz step frequency is difficult.how do i send frequency with 0.001hz step fre

so, i need solution to overcome with issue.please help me its urgent.


is it possible?

Thank you.

Post Reply

Return to “mikroPascal FAQ”