AD9833 Perfect Square wave but no Triangle or Sin

Hey EngineerZone,

I am attemping to program an AD9833 using a PIC18F2525 and its SPI Interface.

I can succefully get a Nice & Clean Square wave out of VOUT at different Frequencies, but the moment I change the Control Word to select ether a Sin or Triangle selection, VOUT goes to 0 Volts flat line.

The AD9833 is wired up as the following :

I do not think its a SPI communication problem because anything to do with square wave works perfectly. Made sure with a scope that that correct data from SDATA is indeed being applied on each Falling Edge of SCLK; which is the case.

At first I Thought it was my Control Word Settings that were incorrect but after using the same Data given from the AD9833 Device Configuration Assistant( the same results are atteined EG. Anything to do with Square Wave works fine, but Sin & Triangle nothing at VOUT.

Here is my Snippit of code that has to do with AD9833 Comunication:

ChipSelect = 1;

SPI_COM(unsigned char Wave_Count)
   // Calculation();

    SPI_Packet[0] = 0x2120; // Enable Reset Set for SquareWave
    SPI_Packet[1] = 0x50C7; /*FreqLSB;*/
    SPI_Packet[2] = 0x4000; /*FreqMSB;*/
    SPI_Packet[3] = 0xC000; // Write to Phase Register 0
    SPI_Packet[4] = 0x2020; // Remove Reset Set for SquareWave

    while(SPI_Packet_Count != 5)
    SPI_Packet_Count = 0;

SPI_Out(unsigned int DataWord)
unsigned char Bytes[2];
unsigned char count = 0;
unsigned char Bytes_Buffer = 0; 
Bytes[0] = DataWord >> 8;
DataWord = DataWord << 8;
Bytes[1] = DataWord >> 8;

    SSPBUF = Bytes[0];
        while(PIR1bits.SSPIF == 0)
    PIR1bits.SSPIF = 0;
    SSPBUF = Bytes[1];
        while(PIR1bits.SSPIF == 0)
    PIR1bits.SSPIF = 0;

//Turns on Correct FSYNC Pin(My Project will have 2 AD9833 to communicate with)
ChipModeSelect(unsigned char done)

if(done == 1)
    PORTCbits.RC1 = 1;
    PORTCbits.RC2 = 1;
    done = 0;
        if(ChipSelect == 1)
            PORTCbits.RC2 = 0; //AD9833 1

            PORTCbits.RC1 = 0; //AD9833 2

Essentialy in this Example I should only have to change the Control Word in SPI_Packet[0] & SPI_Packet[4] respectivly to (0x2100) &(0x2000) for Sin Wave and (0x2102) & (0x2002) for Triangle, correct?(According to AD9833 Device Configuration Assistant and Data Sheet) But this is not the case.

Has anyone had a problem such as this?

Any help is appricated, this is the only thing stopping me from sending my project from Alpha to the Beta Stage.

Thank You,


Parents Reply Children
No Data