Post Go back to editing

AD9851 is not working!

Hello everyone,

I have a AD9851 and try to make different sin-waves with frequencies around 0 to 15 MHz. Here are my Schematics:

I connected it to a teensy 2.6 Microcontroller and programmed it with arduino ide. I run it in serial mode and with the 6xREFCLK-function. Here my Code:

/*************************** VARIABLE DECLARATION ***************************/
// ADC init variabl
int ADC_RESOLUTION = 13;


// AD9851 Pins
int wclk = A8;
int fqud = A7;
int DATA = A9;


unsigned long  freq = 0;
unsigned long  DDSLong;
unsigned long Bitmask32 = 1;
float twoE32 =pow (2,32);
float clock_frequency = 180000000;


int LED = 24;



/*************************** SETUP ***************************/
void setup() {

  
  // put your setup code here, to run once:
  pinMode(wclk, OUTPUT);
  pinMode(fqud, OUTPUT);
  pinMode(DATA, OUTPUT);

  // AD9851 enter serial mode
  digitalWrite(wclk, HIGH);
  digitalWrite(wclk, LOW);
  digitalWrite(fqud, HIGH);
  digitalWrite(fqud, LOW);

  pinMode(AD8302_MAG, INPUT);
  pinMode(AD8302_PHASE, INPUT);

  pinMode(LED, OUTPUT);
  digitalWrite(LED, HIGH);

  
  // Teensy 3.6 set  adc resolution
  analogReadResolution(ADC_RESOLUTION);
  
  Serial.begin(9600);    
}



void loop() {
  // put your main code here, to run repeatedly:

  for(freq = 0; freq <= 15000000; freq += 100000)
  {
  //freq = 2; // Frequenz in Kilohertz
  DDSLong =  (unsigned long)((twoE32 * (freq))/ clock_frequency);


  for (int i = 0; i <= 31; i++)
  {
    if(DDSLong & ((unsigned long)1<<i))
    {
      digitalWrite(DATA,LOW); 
    }  
    else
    {
      digitalWrite(DATA,LOW); 
    }
    digitalWrite(wclk,HIGH); 
    digitalWrite(wclk,LOW); 
  }

  for (int i = 0; i <= 7; i++)
  {
    if ( i == 0)
    {
      digitalWrite(DATA,HIGH);
    }
    else
    {
      digitalWrite(DATA,LOW);
    }

      digitalWrite(wclk,HIGH);
      digitalWrite(wclk,LOW);  
     
  }

  digitalWrite(fqud,HIGH); 
  digitalWrite(fqud,LOW); 
  ...

hope you can help me. Thanks!

Parents Reply Children
No Data