📄 ad9850 dds控制子程序 - dds-锁相环 - radiobook dds锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输pldfpgavhdl免费虚拟主机 - powered by discuz!.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0045)http://www.radiobook.cn/viewthread.php?tid=16 -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>AD9850 DDS控制子程序 - DDS/锁相环 - Radiobook DDS|锁相环|频率合成|大学生电子设计大赛|中文器件资料下载|调频发射|单片机|无线数据传输|PLD|FPGA|VHDL|免费虚拟主机 - Powered by Discuz!</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META
content=dds,DDS,频率合成,中文器件资料下载,锁相环,电子设计,电子设计大赛,大学生电子设计大赛,调频发射,无线,无线数据传输,单片机,PLD,FPGA,VHDL,下载,资源下载,免费虚拟主机
name=keywords>
<META
content=" Radiobook 经常做其他的单片机实验,还没做过DDS的实验。最近打算写个程序试验一下。&lt;br /&gt; &lt;br /&gt; 看了N久datasheet和别人的例子,就开始写程序了。可到了控制字的计算,发现还 ... - Discuz! Board"
name=description>
<META content="MSHTML 6.00.2900.3132" name=GENERATOR>
<META content="Discuz! Team and Comsenz UI Team" name=author>
<META content="2001-2007 Comsenz Inc." name=copyright>
<META content=True name=MSSmartTagsPreventParsing>
<META http-equiv=MSThemeCompatible content=Yes><LINK title=Radiobook
href="http://www.radiobook.cn/archiver/" rel=archives><LINK id=css
href="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/style_1.css"
type=text/css rel=stylesheet>
<SCRIPT type=text/javascript>var IMGDIR = 'images/default';var SMDIR = 'images/smilies';var attackevasive = '0';</SCRIPT>
<SCRIPT
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/common.js"
type=text/javascript></SCRIPT>
<SCRIPT
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/menu.js"
type=text/javascript></SCRIPT>
<SCRIPT
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/ajax.js"
type=text/javascript></SCRIPT>
</HEAD>
<BODY onkeydown="if(event.keyCode==27) return false;">
<DIV id=append_parent></DIV>
<DIV id=ajaxwaitid></DIV>
<DIV class=wrap>
<DIV id=header>
<H2><A title=Radiobook href="http://www.radiobook.cn/index.php"><IMG
alt=Radiobook
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/logo.gif"
border=0></A></H2>
<DIV id=ad_headerbanner></DIV></DIV>
<DIV id=menu>
<UL>
<LI><A href="http://www.radiobook.cn/register.php">注册</A> </LI>
<LI><A href="http://www.radiobook.cn/logging.php?action=login">登录</A> </LI>
<LI><A href="http://www.radiobook.cn/member.php?action=list">会员</A> </LI>
<LI class=dropmenu id=stats onmouseover=showMenu(this.id)><A
href="http://www.radiobook.cn/stats.php">统计</A> </LI>
<LI><A href="http://www.radiobook.cn/faq.php">帮助</A> </LI></UL></DIV>
<SCRIPT
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/viewthread.js"
type=text/javascript></SCRIPT>
<SCRIPT type=text/javascript>zoomstatus = parseInt(1);</SCRIPT>
<DIV id=foruminfo>
<DIV id=nav><A href="http://www.radiobook.cn/index.php">Radiobook</A> » <A
href="http://www.radiobook.cn/forumdisplay.php?fid=13">DDS/锁相环</A> » AD9850
DDS控制子程序 </DIV></DIV>
<DIV id=ad_text></DIV>
<DIV class=pages_btns>
<DIV class=threadflow><A
href="http://www.radiobook.cn/redirect.php?fid=13&tid=16&goto=nextoldset">‹‹
上一主题</A> | <A
href="http://www.radiobook.cn/redirect.php?fid=13&tid=16&goto=nextnewset">下一主题
››</A></DIV><SPAN class=postbtn id=newspecial
onmouseover="$('newspecial').id = 'newspecialtmp';this.id = 'newspecial';showMenu(this.id)"><A
href="http://www.radiobook.cn/post.php?action=newthread&fid=13&extra="><IMG
title=发新话题 alt=发新话题
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/newtopic.gif"
border=0></A></SPAN> <SPAN class=replybtn><A
href="http://www.radiobook.cn/post.php?action=reply&fid=13&tid=16&extra="><IMG
alt=""
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/reply.gif"
border=0></A></SPAN></DIV>
<UL class="popupmenu_popup newspecialmenu" id=newspecial_menu
style="DISPLAY: none">
<LI><A
href="http://www.radiobook.cn/post.php?action=newthread&fid=13&extra=">发新话题</A>
</LI>
<LI class=poll><A
href="http://www.radiobook.cn/post.php?action=newthread&fid=13&extra=&special=1">投票</A>
</LI>
<LI class=trade><A
href="http://www.radiobook.cn/post.php?action=newthread&fid=13&extra=&special=2">商品</A>
</LI>
<LI class=reward><A
href="http://www.radiobook.cn/post.php?action=newthread&fid=13&extra=&special=3">悬赏</A>
</LI>
<LI class=activity><A
href="http://www.radiobook.cn/post.php?action=newthread&fid=13&extra=&special=4">活动</A>
</LI>
<LI class=debate><A
href="http://www.radiobook.cn/post.php?action=newthread&fid=13&extra=&special=5">辩论</A>
</LI></UL>
<SCRIPT type=text/javascript>function fastreply(subject) { if($('postform')) { $('postform').subject.value = subject; $('postform').message.focus(); }}</SCRIPT>
<FORM name=modactions method=post><INPUT type=hidden value=91b4d567
name=formhash>
<DIV class="mainbox viewthread"><SPAN class=headactions><A
href="http://www.radiobook.cn/viewthread.php?action=printable&tid=16"
target=_blank>打印</A> </SPAN>
<H1>AD9850 DDS控制子程序 </H1><INS><A
href="http://www.radiobook.cn/space/index.php?action/viewspace/itemid/366"
target=_blank>本帖已经被作者加入个人空间</A> </INS>
<TABLE id=pid22 cellSpacing=0 cellPadding=0 summary=pid22>
<TBODY>
<TR>
<TD class=postauthor><CITE><A class=dropmenu id=userinfo22
onmouseover=showMenu(this.id)
href="http://www.radiobook.cn/space.php?uid=1"
target=_blank>admin</A></CITE>
<DIV class=avatar><IMG height=120 alt=""
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/1.gif"
width=116 border=0></DIV>
<P><EM>管理员</EM></P>
<P><IMG alt="Rank: 9"
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/star_level3.gif"><IMG
alt="Rank: 9"
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/star_level3.gif"><IMG
alt="Rank: 9"
src="AD9850 DDS控制子程序 - DDS-锁相环 - Radiobook DDS锁相环频率合成大学生电子设计大赛中文器件资料下载调频发射单片机无线数据传输PLDFPGAVHDL免费虚拟主机 - Powered by Discuz!.files/star_level1.gif"></P>
<UL>
<LI class=space><A title=admin的个人空间
href="http://www.radiobook.cn/space.php?uid=1" target=_blank>个人空间</A>
</LI>
<LI class=pm><A id=ajax_uid_22
onclick="ajaxmenu(event, this.id, 9000000, null, 0)"
href="http://www.radiobook.cn/pm.php?action=send&uid=1"
target=_blank>发短消息</A> </LI>
<LI class=buddy><A id=ajax_buddy_0
onclick="ajaxmenu(event, this.id, null, 0)"
href="http://www.radiobook.cn/memcp.php?action=buddylist&newbuddyid=1&buddysubmit=yes"
target=_blank>加为好友</A> </LI>
<LI class=offline>当前离线 </LI></UL></TD>
<TD class=postcontent>
<DIV class=postinfo><STRONG title=复制帖子链接到剪贴板
onclick="setcopy('http://www.radiobook.cn/viewthread.php?tid=16&page=1#pid22', '帖子链接已经复制到剪贴板')">1<SUP>#</SUP></STRONG>
<EM onclick="$('postmessage_22').className='t_bigfont'">大</EM> <EM
onclick="$('postmessage_22').className='t_msgfont'">中</EM> <EM
onclick="$('postmessage_22').className='t_smallfont'">小</EM> 发表于 2007-4-3
16:03 <A
href="http://www.radiobook.cn/viewthread.php?tid=16&page=1&authorid=1">只看该作者</A>
</DIV>
<DIV id=ad_thread2_0></DIV>
<DIV class="postmessage defaultpost">
<DIV id=ad_thread3_0></DIV>
<DIV id=ad_thread4_0></DIV>
<H2>AD9850 DDS控制子程序</H2>
<DIV class=t_msgfont
id=postmessage_22>经常做其他的单片机实验,还没做过DDS的实验。最近打算写个程序试验一下。<BR><BR>看了N久datasheet和别人的例子,就开始写程序了。可到了控制字的计算,发现还真是麻烦。由于我是用C写程序,所以一开始定义了long型变量,让它算,几行代码就解决了。不过一想,单片机这样算也太慢了吧,要是一转编码器,频率变化几十次上百次,单片机还不累死了<BR><BR>于是想换个查表方式吧。搞了一上午,把算法搞好,表也算好做出来了,一编译,晕!长出了好几百字节(这其中包括表本身约200字节,再加上算法中多句的加法代码),看来2051里面别想放了。
<BR><BR>看来,鱼和熊掌,不可兼得。要速度,代码量就大。要代码精简,速度就慢。这大概就是单片机的真谛吧。<BR><BR>我的查表算法思路是这样的<BR>:<BR>1、构造N个二维数组(N=你需要输入的最大频率值位数,例如你需要精确到10HZ,最高30MHZ,那么就有10M位、1M位、100K位、10K位、1K位、100HZ位、10HZ位,共7位,所以N=7)。<BR>2、根据你所用的芯片型号,和晶振频率,计算出每个频率位0-9时的控制字。<BR>3、使用时,把你频率的每一位控制字,查表读出,并相加(特别需要注意进位也需要处理)。<BR>4、把加出的4字节控制字,送DDS。<BR><BR>此方法,理论最大控制字误差为N。一般9851或9850DDS,常用的晶振频率值条件下,此误差实际表现在频率上时,小于1HZ的1到2个数量级。<BR><BR>查表部分具体程序(尚未进行硬件测试)<BR><BR>程序代码<BR><BR><BR>/*******************************************<BR>
AD9850
DDS控制子程序<BR>********************************************<BR>编写:BG4UVR<BR>描述:
MCS51单片机控制AD9850/AD9851子程序。<BR>
提供如下5个常用DDS控制函数。例子中<BR>
DDS控制字表的DDS型号为AD9850,晶振<BR>
为16MHZ。<BR>注意:
使用前请修改程序内相应硬件端口<BR>********************************************/<BR>void
dds_reset(void); //DDS主复位程序<BR>void
dds_serialmode(void); //DDS串行方式设置<BR>void
dds_set(void);
//DDS设置数据发送<BR>void fre2word(void);
//DDS控制字计算<BR>void freupdata(void);
//DDS频率输出更新<BR>/*******************************************/<BR><BR>//其他函数此处省略,只留下了表的结构和控制字计算部分……<BR><BR>/********************************************/<BR>//控制字表,DDS=9850,晶振=16MHZ<BR>
//word=0x100000000*fre/16000000;<BR>/********************************************/<BR>unsigned
char code dds_word_10mhz[2][4]={<BR>
0x00,0x00,0x00,0x00,<BR>
0x00,0x00,0x00,0xa0<BR>};<BR><BR>unsigned char code
dds_word_1mhz[10][4]={<BR> 0x00,0x00,0x00,0x00,<BR>
0x00,0x00,0x00,0x10,<BR>
0x00,0x00,0x00,0x20,<BR> 0x00,0x00,0x00,0x30,<BR>
0x00,0x00,0x00,0x40,<BR>
0x00,0x00,0x00,0x50,<BR> 0x00,0x00,0x00,0x60,<BR>
0x00,0x00,0x00,0x70,<BR>
0x00,0x00,0x00,0x80,<BR>
0x00,0x00,0x00,0x90<BR>};<BR>unsigned char code
dds_word_100khz[10][4]={<BR> 0x00,0x00,0x00,0x00,
//0<BR>
0x99,0x99,0x99,0x01, //1<BR>
0x33,0x33,0x33,0x03,
//2<BR> 0xcc,0xcc,0xcc,0x04,
//3<BR>
0x66,0x66,0x66,0x06, //4<BR>
0x00,0x00,0x00,0x08,
//5<BR> 0x99,0x99,0x99,0x09,
//6<BR>
0x33,0x33,0x33,0x0b, //7<BR>
0xcc,0xcc,0xcc,0x0c,
//8<BR> 0x66,0x66,0x66,0x0e
//9<BR>};<BR>unsigned char
code dds_word_10khz[10][4]={<BR> 0x00,0x00,0x00,0x00,
//0<BR>
0xc2,0xf5,0x28,0x00, //1<BR>
0x85,0xeb,0x51,0x00,
//2<BR> 0x47,0xe1,0x7a,0x00,
//3<BR>
0x0a,0xd7,0xa3,0x00, //4<BR>
0xcc,0xcc,0xcc,0x00,
//5<BR> 0x8f,0xc2,0xf5,0x00,
//6<BR>
0x51,0xb8,0x1e,0x01, //7<BR>
0x14,0xae,0x47,0x01,
//8<BR> 0xd7,0xa3,0x70,0x01,
//9<BR>};<BR>unsigned char code
dds_word_1khz[10][3]={<BR> 0x00,0x00,0x00,
//0<BR> 0x93,0x18,0x04,
//1<BR> 0x26,0x31,0x08,
//2<BR> 0xba,0x49,0x0c,
//3<BR> 0x4d,0x62,0x10,
//4<BR> 0xe1,0x7a,0x14,
//5<BR> 0x74,0x93,0x18,
//6<BR> 0x08,0xac,0x1c,
//7<BR> 0x9b,0xc4,0x20,
//8<BR> 0x2f,0xdd,0x24,
//9<BR>};<BR>unsigned char code
dds_word_100hz[10][3]={<BR> 0x00,0x00,0x00,
//0<BR> 0xdb,0x68,0x00,
//1<BR> 0xb7,0xd1,0x00,
//2<BR> 0x92,0x3a,0x01,
//3<BR> 0x6e,0xa3,0x01,
//4<BR> 0x49,0x0c,0x02,
//5<BR> 0x25,0x75,0x02,
//6<BR> 0x00,0xde,0x02,
//7<BR> 0xdc,0x46,0x03,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -