Escolar Documentos
Profissional Documentos
Cultura Documentos
Pin Maps
Pins Definitions
http://www.electrodragon.com/w/AD9850_Module_DDS_Signal_Generator_V2 1/4
7/9/2017 AD9850 Module DDS Signal Generator V2 - ElectroDragon
Software Description
The AD9850 contains a 40-bit register that is used to program the 32-bit frequency control word, the 5-bit phase
modulation word and the power-down function. This register can be loaded in a parallel or serial mode.
In the parallel load mode, the register is loaded via an 8-bit bus; the full 40-bit word requires five iterations of the
8-bit word. The W_CLK and FQ_UD signals are used to address and load the registers. The rising edge of FQ_UD
loads the (up to) 40-bit control data word into the device and resets the address pointer to the first register.
Subsequent W_CLK rising edges load the 8-bit data on words [7:0] and move the pointer to the next register. After
five loads, W_CLK edges are ignored until either a reset or an FQ_UD rising edge resets the address pointer to the
first register.
In serial load mode, subsequent rising edges of W_CLK shift the 1-bit data on Lead 25 (D7) through the 40 bits of
programming information. After 40 bits are shifted through, an FQ_UD pulse is required to update the output
frequency (or phase).
#define W_CLK 8 // Pin 8 - connect to AD9850 module word load clock pin (CLK)
#define FQ_UD 9 // Pin 9 - connect to freq update pin (FQ)
#define DATA 10 // Pin 10 - connect to serial data load pin (DATA)
#define RESET 11 // Pin 11 - connect to reset pin (RST).
// transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line
void tfr_byte(byte data)
{
for (int i=0; i<8; i++, data>>=1) {
digitalWrite(DATA, data & 0x01);
pulseHigh(W_CLK); //after each bit sent, CLK is pulsed high
}
}
// frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32
void sendFrequency(double frequency) {
int32_t freq = frequency * 4294967295/125000000; // note 125 MHz clock on 9850
for (int b=0; b<4; b++, freq>>=8) {
tfr_byte(freq & 0xFF);
}
tfr_byte(0x000); // Final control byte, all 0 for 9850 chip
pulseHigh(FQ_UD); // Done! Should see output
}
void setup() {
// configure arduino data pins for output
pinMode(FQ_UD, OUTPUT);
pinMode(W_CLK, OUTPUT);
pinMode(DATA, OUTPUT);
pinMode(RESET, OUTPUT);
pulseHigh(RESET);
pulseHigh(W_CLK);
pulseHigh(FQ_UD); // this pulse enables serial mode - Datasheet page 12 figure 10
}
void loop() {
sendFrequency(10.e6); // freq
while(1);
}
http://www.electrodragon.com/w/AD9850_Module_DDS_Signal_Generator_V2 3/4
7/9/2017 AD9850 Module DDS Signal Generator V2 - ElectroDragon
using integer maths. In theory, integer maths should be slightly faster and more accurate as the required frequency
increases, in practice I find either method fast enough and accurate enough up to 30MHz, frequency errors are due
to the poor stability of the reference oscillator on the DDS module. Calculating the turning word and writing it to
the DDS module can them be wrapped up in a single function taking the required frequency as its sole parameter
References
Arduino library not yet tested. (https://code.google.com/p/ad9850-arduino/)
http://www.electrodragon.com/w/AD9850_Module_DDS_Signal_Generator_V2 4/4