AnsweredAssumed Answered

Problem with phase shifting in AD9833

Question asked by nandinimbt22 on Apr 6, 2018
Latest reply on Apr 25, 2018 by musach

I am trying to control phase shift using AD9833 DDS , it seems phase is getting modified, but it is not working as expected. apart from phase , signal generation and frequency modification was working fine.

 

same thing tested with different controllers.

here is phase modification code snippet with arduino board. 

 

#define BITS_PER_DEG    11.3777777777778  //->  4096 / 360
#define PHASE_WRITE_CMD    0xC000


void AD9833_Phase(unsigned char fsync, uint32_t phaseInDeg)
{
phaseInDeg = fmod(phaseInDeg,360);
 if ( phaseInDeg < 0 ) 
     phaseInDeg += 360;

 uint16_t phaseVal = (uint16_t)phaseInDeg & 0x0FFF;
 phaseVal |= PHASE_WRITE_CMD;
 digitalWrite(FSYNC, LOW);             // Set FSYNC low  
  AD9833_Write(0xC000 | (0x1FFF & (uint16_t)(phaseVal)));  
  AD9833_Write(0xE000 | (0x1FFF & (uint16_t)(phaseVal>>12)));  
 digitalWrite(FSYNC, HIGH);            // Set FSYNC high 

}

 

please help me to come out.

you can find source code in attachment.

 

Thank you 

Attachments

Outcomes