AnsweredAssumed Answered

DDS AD9834 with PIC controller

Question asked by aruner92 on Jun 19, 2015
Latest reply on Jul 8, 2015 by languer

try to generate sine wave from 9834 using pic MC.

 

got wave form in scope is good for spi.

but cant get the proper o/p.

 

 

#include <16f1947.h>

#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP

#use delay (clock=20mhz)

 

#define DDS_SELECT PIN_D7

 

void DDS_Cntl(unsigned int16 data)

{

  #use spi(FORCE_HW, MODE=1,SPI2, BITS=16, LSB_FIRST, stream=SPI_STREAM, MSB_FIRST)

  output_low(DDS_SELECT);

   delay_us(2);

  spi_xfer(data);

  delay_us(1);

  output_high(DDS_SELECT);

    delay_us(80);

}

 

 

void main()

{

  unsigned int16 Ds=0xfff,Gs=0;

  set_tris_d(0x00);

    output_d(0x00);

 

  while(1)

  {

 

  DDS_Cntl(0x2100);

  // delay_us(10);

 

  DDS_Cntl(0x4ff8);

  // delay_us(2);

  DDS_Cntl(0x4000);

  // delay_us(2);

  DDS_Cntl(0xC000);

  // delay_us(2);

  // DDS_Cntl(0x2000);

  delay_us(80);

  }

  }

}

 

 

any hardware/software suggestions to correct my O/P?

Outcomes