====== AD9850 ======
{{:materiel:ad9850:oscillo-ad9850.jpg?500|}}\\
Générateur de signaux sinusoïdaux ou carré.
{{youtube>3lNGF0PJUpk?medium}}
===== Datasheet =====
* {{:materiel:ad9850:ad9850.pdf|}}
* 2 sine wave and 2 square wave output (mais tous avec la même fréquence !)
* AD9850: 0-40MHz
* After the 20-30MHz frequency harmonics increases, the waveform will be less and less clean
* Square Wave: 0-1MHz
* Low-pass filter with 70MHz, so the waveform better than SN
* Parallel and serial data input can be selected via a jumper
* DA produced the benchmark pin (PIN12) leads for easy adjustment to do the magnitude of the output waveform Application
* Comparator reference input voltage generated by the variable resistor, the resistor can be adjusted duty cycle square wave of different
* Active AD9850 125MHz crystal oscillator modules
===== Avec Arduino =====
* https://code.google.com/p/ad9850-arduino/
* http://www.elecfreaks.com/wiki/index.php?title=DDS_Module_-_AD9850
* http://arduino.alhin.de/index.php?n=67
* http://nr8o.dhlpilotcentral.com/?p=83
* http://rockingdlabs.dunmire.org/exercises-experiments/ad-9850-dds-synthesizer
* http://www.alhin.de/arduino/index.php?n=7
* http://www.kerrywong.com/2012/11/06/dds-function-generator-build/
* http://webshed.org/wiki/AD9850_Arduino
==== Connection ====
Il suffit de 6 fils.
| **ARDUINO** | **AD9850** |
| 5V | VCC |
| GND | GND |
| 8 | W_CLK |
| 9 | FQ_UD |
| 10 | DATA |
| 11 | RESET |
{{:materiel:ad9850:arduino-deux-ad9850.jpg?600|}}
==== Code Arduino pour deux modules ====
**Sans librairie à installer** ++++ Voir le code |
/*
* USE TWO AD9850
* Modified from http://nr8o.dhlpilotcentral.com/?p=83
*/
// 1st MODULE
#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).
// 2nd MODULE
#define W_CLK2 4 // Pin 4 - connect to AD9850 module word load clock pin (CLK)
#define FQ_UD2 5 // Pin 5 - connect to freq update pin (FQ)
#define DATA2 6 // Pin 6 - connect to serial data load pin (DATA)
#define RESET2 7 // Pin 7 - connect to reset pin (RST).
#define pulseHigh(pin) {digitalWrite(pin, HIGH); digitalWrite(pin, LOW); }
// transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line
void tfr_byte(byte data, int pin_clock, int pin_data)
{
for (int i=0; i<8; i++, data>>=1) {
digitalWrite(pin_data, data & 0x01);
pulseHigh(pin_clock); //after each bit sent, CLK is pulsed high
}
}
// frequency calc from datasheet page 8 = * /2^32
void sendFrequency(double frequency, int pin_clock, int pin_fq, int pin_data) {
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, pin_clock, pin_data);
}
tfr_byte(0x000, pin_clock, pin_data); // Final control byte, all 0 for 9850 chip
pulseHigh(pin_fq); // 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);
pinMode(FQ_UD2, OUTPUT);
pinMode(W_CLK2, OUTPUT);
pinMode(DATA2, OUTPUT);
pinMode(RESET2, OUTPUT);
pulseHigh(RESET);
pulseHigh(W_CLK);
pulseHigh(FQ_UD); // this pulse enables serial mode - Datasheet page 12 figure 10
pulseHigh(RESET2);
pulseHigh(W_CLK2);
pulseHigh(FQ_UD2); // this pulse enables serial mode - Datasheet page 12 figure 10
}
void loop() {
sendFrequency(1320, W_CLK, FQ_UD, DATA); // freq
sendFrequency(440, W_CLK2, FQ_UD2, DATA2); // freq
while(1);
}
++++
**Avec la librairie [[http://arduino.alhin.de/download.php?id=28|AH_AD9850.h]]**
++++ Voir le code |
// from http://www.arduino-projekte.de
#include
#define CLK 6
#define FQUP 7
#define BitData 8
#define RESET 9
AH_AD9850 AD9850(CLK, FQUP, BitData, RESET);
void setup()
{
AD9850.reset(); //reset module
delay(1000);
AD9850.powerDown(); //set signal output to LOW
// initialize serial communication
Serial.begin(9600);
}
void loop(){
//set_frequency(boolean PowerDown, byte Phase, double Freq);
AD9850.set_frequency(0,0,1000); //set power=UP, phase=0, 1kHz frequency
delay(1000);
AD9850.set_frequency(2500); //set 2.5kHz frequency
delay(1000);
AD9850 << 5000; //set 5kHz frequency in C++ style
delay(1000);
//phase test
for (int phase=0;phase<32;phase++)
{
AD9850.set_frequency(0, phase, 1000); //change phase delay in 11.25°(2PI/32) steps
delay(1000);
}
}
++++
===== Modulation =====
Deux signaux modulés par une porte ET : \\
{{:materiel:ad9850:ad9850-modulation.jpg?400|}}
Le schéma de la porte ET avec deux diodes et une résistance (merci Patrick!)\\
{{:materiel:ad9850:and_10.gif|}}
===== Signal carré =====
Il faut modifier le "duty cycle" du signal carré avec le potentiomètre.
{{:materiel:ad9850:ad9850-square.jpg?600|}}