AnsweredAssumed Answered

AD9834 SIGN BIT OUT

Question asked by jczhang on Jul 7, 2018

Hello. I use AD9834 to design a signal generator. I want to have a 8MHz to 10MHz square wave output. I have designed a 5th order LPF to filter the sin wave and want to feed it back to the Vin to get the square wave. But I find there is always a 14MHz square wave output from the SIGN BIT OUT even my Vin pin is hanging. I have checked the demand I send it should be right.

 

void loop() {
unsigned long Fin, N;
Fin = 1000000L; 
DDS_SEND(0x2100);
delayMicroseconds(2);
while(1) {

N = long(float(Fin) * 5.36870912); 
digitalWrite(12, LOW); 
DDS_SEND(0x2238);
delayMicroseconds(2);
DDS_SEND(0x4000L + (N & 0x3FFF));
delayMicroseconds(2);
DDS_SEND(0x4000L + ((N >> 14) & 0x3FFF));
delayMicroseconds(2);
}
}

 

Here is the main body of my code. The attachment is the square wave always have, which prevents me to get the correct output from the comparator. I think the code is correct because I can get sin wave in the frequency correctly I want.

 

Any help will be appreciated! I am quite hurry to solve this problem. Thank you very much!

 

Regards

Outcomes