資源簡介
該程序利用MSP430單片機(jī)控制AD9850模塊產(chǎn)生頻率可調(diào)的方波及正弦波信號輸出,可作為信號源。

代碼片段和文件信息
/*****************************
code?name : AD9850
code?function?? : the?code?is?used?to?control?the?AD9850?with?msp430.
DDS?Frequency : under?45MHz(?125Mhz?XTAL?)
coder :???Du?Li?David?Pei?
fisrt?code?date :?? 09-8-4
last?updated??? :?? 09-8-6
*******************************/
/************pin?definition********
P2.0(pin?80)?-->D7(pin?25)
?? P2.1(pin?79)????W_CLK(pin?7)
?? P2.2(pin?78)????FQ_UD(pin?8)?
?? P2.3(pin?77)????RESET(pin?22)
**********************************/
#include??“msp430x44x.h“
#define?dat? BIT0;
#define?clk? BIT1;
#define?update BIT2;
#define?rst BIT3;
//RESET?FUNCTION
void?reset();
//DELAY?FUNCTION
void?delay(int?i);
//SET?THE?FREQUENCY
void?set_fq(unsigned?long?fq);
void?main()
{?
unsigned?long?feqi;
WDTCTL?=?WDTPW?+?WDTHOLD;
P2SEL=0;
P2DIR=0xFF;
P2OUT=0;
for(i=0;i<20;i++)
{
reset();
}
feq=?10*?34359738.37;?//set?frequency?to?10MHz;
while(1)
{
set_fq(feq);
}
};
void?reset()
{
P2OUT|=rst;
delay(10);
P2OUT^=rst;
_NOP();
}
void?set_fq(unsigned?long?fq)
{
unsigned?char?FqWord[5];
int?ij;
//set?the?32bit?tuning?word(frequency?control?word)
FqWord[0]=(fq?&?0x000000ff); //7~0
FqWord[1]=(fq?&?0x0000ff00)>>8; //15~8
FqWord[2]=(fq?&?0x00ff0000)>>16; //23~16
FqWord[3]=(fq?&?0xff000000)>>24; //31~24
FqWord[4]=0; //39~32
//load?
P2OUT?&=?~update;
for(i=0;i<5;i++)
{
unsigned?char?tmp=0x00000001;
for(j=0;j<8;j++)
{
if(?(?FqWord[i]?&?tmp?)?==?tmp?) //load?each?bit?seperately
{
P2OUT?|=?dat;?
}
else
{
P2OUT?&=?~dat;
}
_NOP();
P2OUT?|=?clk;
_NOP();
P2OUT?&=?~clk;
_NOP();
tmp=tmp<<1;
}
}
P2OUT?|=?update;
delay(10);
P2OUT?=?0x00;
}
void?delay(int?i)
{
for(;i-->0;);
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????2156??2009-08-10?13:25??AD9850\AD9850.dep
?????文件??????13407??2009-08-03?16:28??AD9850\AD9850.ewd
?????文件??????45152??2009-08-03?16:28??AD9850\AD9850.ewp
?????文件????????160??2009-07-29?20:25??AD9850\AD9850.eww
?????文件??????11915??2009-07-29?20:43??AD9850\Backup?of?AD9850.ewd
?????文件??????44599??2009-07-29?20:43??AD9850\Backup?of?AD9850.ewp
?????文件??????15777??2009-08-03?21:03??AD9850\Debug\Exe\AD9850.d43
?????文件????????137??2009-08-10?13:25??AD9850\Debug\Obj\AD9850.pbd
?????文件??????10097??2009-08-03?21:03??AD9850\Debug\Obj\main.r43
?????文件???????1806??2009-08-08?20:15??AD9850\main.cpp
?????文件???????2521??2009-08-10?13:25??AD9850\settings\AD9850.cspy.bat
?????文件???????3724??2009-08-10?13:25??AD9850\settings\AD9850.dbgdt
?????文件????????996??2009-08-10?13:25??AD9850\settings\AD9850.dni
?????文件???????2761??2009-08-10?13:25??AD9850\settings\AD9850.wsdt
?????目錄??????????0??2009-08-03?20:59??AD9850\Debug\Exe
?????目錄??????????0??2009-07-29?20:55??AD9850\Debug\List
?????目錄??????????0??2009-08-10?13:25??AD9850\Debug\Obj
?????目錄??????????0??2009-07-29?20:55??AD9850\Debug
?????目錄??????????0??2009-08-03?14:22??AD9850\settings
?????目錄??????????0??2009-08-08?20:15??AD9850
-----------?---------??----------?-----??----
???????????????155208????????????????????20
- 上一篇:條碼批次出入庫
- 下一篇:車牌檢測訓(xùn)練正樣本,共1350張
評論
共有 條評論