号称正弦波 70MHz,其实呢。。。实测正弦波 0-20M较好,20-30M勉强,30-70M比较玄幻。
方波1MHz倒是有的,甚至10M也能出波形,只是惨些。
正弦波?方波 切换靠模块的两对物理引脚提供,所以只剩下一个参数 “频率值” 可以设定,网页控制比较简单。
手机控制 波形发生器 AD9851-其他-高清完整正版视频在线观看-优酷 (youku.com)https://v.youku.com/v_show/id_XNTkwMDAxMTE5Ng==.html
?
----------------------------------------------------------------------------------------------------------------------
下面是基础测试,把以下两个文件都放 AD9851 目录里,写入UNO即可:
1。? ? AD9851.ino
const int WCLK = 10; // UNO接线
const int FQUP = 9;
const int REST = 8;
const int DATA = 7;
# include "AD9851.h"
String Input_Command;
unsigned long Input_Frequency = 0; // 取值范围 0-4294967295 (2^32-1)
void setup() {
pinMode(WCLK, OUTPUT);
pinMode(FQUP, OUTPUT);
pinMode(REST, OUTPUT);
pinMode(DATA, OUTPUT);
Serial.begin(115200);
AD9851_First_Load();
}
void loop() {
}
2。? ? ? AD9851.h
void AD9851_Reset_Serial_Model()
{
Serial.print("Reseting AD9851 to Serial Model...");
digitalWrite(WCLK, LOW);
digitalWrite(FQUP, LOW);
//restSignal
digitalWrite(REST, LOW);
digitalWrite(REST, HIGH);
digitalWrite(REST, LOW);
//wclkSignal
digitalWrite(WCLK, LOW);
digitalWrite(WCLK, HIGH);
digitalWrite(WCLK, LOW);
//fqupSignal
digitalWrite(FQUP, LOW);
digitalWrite(FQUP, HIGH);
digitalWrite(FQUP, LOW);
Serial.println("done!");
}
void DataJudge(unsigned char w)
{
if (w == 1) digitalWrite(DATA, HIGH);
else if (w == 0) digitalWrite(DATA, LOW);
}
void Write_Frequency_To_AD9851_Via_SPI(unsigned char w0, double frequence)
{
unsigned char i, w;
long int y;
double x; //计算频率的HEX值
x = 4294967295 / 180; //适合180M晶振/180为最终时钟频率(或30M六倍频) //如果时钟频率不为180MHZ,修改该处的频率值,单位MHz !!!
frequence = frequence / 1000000;
frequence = frequence * x;
//Serial.print("Frequency in HEX:"); Serial.println(frequence); // 折算后的频率值,熟悉后可不要这句
y = frequence;
//写w4数据
w = (y >>= 0);
for (i = 0; i < 8; i++)
{
DataJudge((w>> i) & 0x01);
digitalWrite(WCLK, HIGH);
digitalWrite(WCLK, LOW);
}
//写w3数据
w = (y >> 8);
for (i = 0; i < 8; i++)
{
DataJudge((w>> i) & 0x01);
digitalWrite(WCLK, HIGH);
digitalWrite(WCLK, LOW);
}
//写w2数据
w = (y >> 16);
for (i = 0; i < 8; i++)
{
DataJudge((w>> i) & 0x01);
digitalWrite(WCLK, HIGH);
digitalWrite(WCLK, LOW);
}
//写w1数据
w = (y >> 24);
for (i = 0; i < 8; i++)
{
DataJudge((w>> i) & 0x01);
digitalWrite(WCLK, HIGH);
digitalWrite(WCLK, LOW);
}
//写w0数据
w = w0;
for (i = 0; i < 8; i++)
{
DataJudge((w>> i) & 0x01);
digitalWrite(WCLK, HIGH);
digitalWrite(WCLK, LOW);
}
//移入始能
digitalWrite(FQUP, HIGH);
digitalWrite(FQUP, LOW);
}
void AD9851_First_Load()
{
AD9851_Reset_Serial_Model();
Write_Frequency_To_AD9851_Via_SPI(0x01, 1000);
Serial.println("Set AD9851 Frequency = 1 kHz by default.");
}
-------------------------------------------------------------------------------------------------------------
进入高频信号的世界,需要正确选择器材。简单说至少需要100M示波器和100M探头才能较好的反映模块的真实波形,杜邦线也就1M以下玩玩。
扩展资料
1、高频(HF)3 MHz~30 MHz,对应电磁波的波长为短波100 m~10 m。
2、甚高频(VHF)30 MHz~300 MHz,对应电磁波的波长为米波10 m~1 m。
甚高频多数是用作电台及电视台广播,同时又是航空和航海的沟通频道。
VHF主要是作较短途的传送,和高频(HF)不同的是,电离层通常不会反射VHF的信号,而且甚高频常常会受环境因素(如:地形)影响其信号。
|