The corresponding Arduino sketch uses the AD9850-Arduino library. It generates also a trigger signal to stabilize the oscillogram:
#include <AD9850.h>
#include <math.h>
#include <stdint.h>
#define ARRAYSIZE 320
#define TRIGGER 11
uint16_t idx = 0;
AD9850 ad(8, 9, 10); // w_clk, fq_ud, d7
uint32_t n[ARRAYSIZE];
void setup() {
pinMode(TRIGGER, OUTPUT);
for (int i = 0; i < ARRAYSIZE; i++) {
n[i] = pow(10.0, 5 + log10(0xffffffffLL) * i / ARRAYSIZE);
// skip dupes
if (i && n[i] < n[i-1])
break;
}
idx = i;
}
void loop() {
digitalWrite(TRIGGER, HIGH);
delay(0);
digitalWrite(TRIGGER, LOW);
ad.setphase(0);
ad.up();
for(int i = 0; i <= idx; i++) {
ad.setphase(0);
ad.setrawfreq(n[i]);
}
ad.down();
}
A German explanation on how to connect to Arduino DDS.
Pages: 1 2