2021-01-29 06:31:58 -05:00
|
|
|
//
|
|
|
|
// FILE: AD9851_sweeper.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo
|
2022-10-25 13:47:34 -04:00
|
|
|
// URL: https://github.com/RobTillaart/AD985X
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
#include "AD985X.h"
|
|
|
|
|
|
|
|
|
|
|
|
AD9851 freqGen;
|
|
|
|
|
|
|
|
uint32_t freq = 0;
|
|
|
|
uint32_t maxFreq = 2000000UL;
|
|
|
|
|
|
|
|
bool up = true;
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
Serial.print("AD985X_LIB_VERSION: \t");
|
|
|
|
Serial.println(AD985X_LIB_VERSION);
|
|
|
|
|
|
|
|
freqGen.begin(10, 9, 8, 7, 6);
|
|
|
|
freqGen.powerUp();
|
|
|
|
freqGen.setAutoRefClock(true);
|
|
|
|
|
|
|
|
freq = 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
if (up == true) freq *= 1.01;
|
|
|
|
else freq /= 1.01;
|
|
|
|
|
|
|
|
if (freq > maxFreq)
|
|
|
|
{
|
|
|
|
freq = maxFreq;
|
|
|
|
up = false;
|
|
|
|
}
|
|
|
|
if (freq < 100)
|
|
|
|
{
|
|
|
|
freq = 100;
|
|
|
|
up = true;
|
|
|
|
}
|
|
|
|
freqGen.setFrequency(freq);
|
|
|
|
Serial.print(millis());
|
|
|
|
Serial.print('\t');
|
|
|
|
Serial.println(freq);
|
|
|
|
delay(50);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -- END OF FILE --
|