资源简介
AD9959,四通道的信号发生器,输出频率能够达到200Mhz,输出的频率相位独立可调,幅值再500毫伏左右

代码片段和文件信息
/*
* Test program for divisor calculation using reciprocal division.
*/
#include
#include
#include
#include
#include “AD9959.h“
#define INCR 0.000005 // The smaller this number the more test data points
#define MAXERR 0.08
#define MAX_FREQ (500*1000*1000)
bool verbose = false;
class MyAD9959
: public AD9959<
2 // ResetPin
3 // ChipEnablePin
4 // UpdatePin
// 25000000 (reference_frequency)
// SPIRate SPIClkPin SPIMISOPin SPIMOSIPin
> {};
void test_dividers(MyAD9959& dds)
{
int count = 0;
int low = 0;
int high = 0;
uint32_t last = 1;
uint32_t freq = 0;
int decade = 2;
int pow10 = 10;
double two32 = pow(2 32);
double sum_of_squares_gen = 0;
double sum_of_squares_acc = 0;
double sum_of_squares_high = 0;
double sum_of_squares_low = 0;
uint32_t core_clock = MAX_FREQ;
#if defined(CLOCK_MULTIPLIER)
// Test with a reduced clock rate
dds.setClock(CLOCK_MULTIPLIER); // Half the core_clock frequency
core_clock /= (20/CLOCK_MULTIPLIER);
#endif
for (double freqr = 10; freqr <= core_clock/2; freqr *= (1+INCR))
{
freq = floor(freqr+0.5);
if (freq == last)
continue;
last = freq;
if (freq > pow10*10)
{
decade++;
pow10 *= 10;
printf(“Progress to %d: %d frequencies tested %d low %d high %d bad\n“ pow10 count low high count-low-high);
}
uint32_t divisor = dds.frequencyDelta(freq);
uint32_t accurate = floor(two32*freq/core_clock + 0.500);
double fgen = 1ULL*core_clock*divisor/two32;
double facc = 1ULL*core_clock*accurate/two32;
double epsilon_gen = fgen-freq; // difference between desired and generated reciprocal method
double epsilon_acc = facc-freq; // difference between desired and generated normal method
sum_of_squares_gen += epsilon_gen*epsilon_gen;
sum_of_squares_acc += epsilon_acc*epsilon_acc;
bool bad = 0;
if (fgen > freq)
{
sum_of_squares_high += epsilon_gen*epsilon_gen;
if (fgen < freq+MAXERR)
high++;
else
bad = 1;
}
if (fgen < freq)
{
sum_of_squares_low += epsilon_gen*epsilon_gen;
if (fgen > freq-MAXERR)
low++;
else
bad = 1;
}
// printf(“Wanted %u Gen %0.4f Acc %0.4f Epsilon gen %g acc %g\n“ freq fgen facc epsilon_gen epsilon_acc);
if (verbose)
printf(“%u -> %u for %.4f “ freq divisor fgen);
if (divisor == accurate)
{
if (verbose)
printf(“good\n“);
}
else
{
if (verbose)
printf(“expected %u (%s)\n“ accurate bad ? “bad“ : “acceptable“);
}
count++;
}
printf(“%d frequencies tested %d low %d high %d bad\n“ count low high count-low-high);
printf(
“Frequency Standard Deviation using reciprocal method %gHz accurate %gHz\n“
sqrt(sum_of_squares_gen/count)
sqrt(sum_of_squares_acc/count)
);
printf(“Upward deviation %.5g\n“ sqrt(sum_of_squares_high/count));
printf(“Downward deviation %.5g\n“ sqrt(sum_of_squares_low/count));
}
int
main(int argc const char** argv)
{
MyAD9959 dds;
if (--argc > 0 &
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-09-13 01:06 AD9959-master\
文件 7 2017-09-13 01:06 AD9959-master\.gitignore
文件 15459 2017-09-13 01:06 AD9959-master\AD9959.h
文件 6608 2017-09-13 01:06 AD9959-master\README.md
文件 322 2017-09-13 01:06 AD9959-master\keywords.txt
文件 243 2017-09-13 01:06 AD9959-master\library.json
文件 271 2017-09-13 01:06 AD9959-master\library.properties
目录 0 2017-09-13 01:06 AD9959-master\test\
文件 474 2017-09-13 01:06 AD9959-master\test\Arduino.h
文件 435 2017-09-13 01:06 AD9959-master\test\SPI.h
文件 53 2017-09-13 01:06 AD9959-master\test\compile
文件 3068 2017-09-13 01:06 AD9959-master\test\ddstest.cpp
- 上一篇:黑马57期不加密版.txt
- 下一篇:url采集/全自动采集url
相关资源
- 一个labview仿真的函数信号发生器.vi
- 《数字信号处理第三版》课后习题答
- 基于蓝牙4.0的设备通信方案设计与实
- 瑞利信道的仿真,包括信号的调制,
- 信号估计DOAmusicespritcapon
- 数字频率合成dds正弦波基于FPGA的DDS产
- 用FFT对信号进行频谱分析
- mp重构一维信号(可运行)
- 信号与系统习题(一到八章的习题)
- 利用语音信号的短时能量与短时过零
- 数字信号处理实验1信号系统及其响应
- 谐波小波分析的源代码,应该属于信
- 2FSK2PSK信号产生器实验实验报告
- 信号与系统 第三版 陈生潭 郭宝龙
- 细菌cyclic di-AMP的信号调控
- 矿井信号收发器通信模块设计
- 矿用多功能WiFi信号转换器的设计
- 基于WiFi技术的矿井信号收发器设计
- Belle-II和ILC的马约拉纳中微子信号
- LabVIEW 声音信号的采集与存储.vi
- 关于DDR3信号扇出和走线问题解析
- 在PCB板设计中高效地使用BGA信号布线
- 压缩感知常见测量矩阵一维仿真信号
- 基于ARM7 PWM定时器的图像传感器时序信
- 用ARM7和UC/OS-II设计的信号采集系统
- 一种用ARM7+UC/OS-II设计的信号采集系统
- 雷帕霉素通过抑制mTOR信号通路促进新
- FC-FS-3 光纤通道帧信号
- 基于51单片机的交通信号灯程序
- 信号与系统PPT 英文版 奥本海姆
评论
共有 条评论