⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 无线收发模块ptr8000发送程序 - 斯玛特精品电子工作室 - 中国电子开发网 - powered by x-space.htm

📁 简单介绍无线射频通信PTR8000的资料
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0058)http://www.cedn.cn/?uid-14020-action-viewspace-itemid-1597 -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>无线收发模块PTR8000发送程序 - 斯玛特精品电子工作室 - 中国电子开发网 - Powered by X-Space</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gbk">
<META content="单片机,c8051 " name=keywords>
<META 
content="开发硬件平台:新华龙增强型单片机C8051开发板、无线模块PTR8000开发软件平台:KeilC51// Header: PTR8000模块发射程序// File Name: send.c // Author: Liu Jianhua// Date: 2006-07-14#include c8051f000.h #in. " 
name=description><LINK title=斯玛特精品电子工作室 
href="http://www.cedn.cn/?uid-14020-action-rss-type-blog" 
type=application/rss+xml rel=alternate><LINK title=RSD 
href="http://www.cedn.cn/xmlrpc.php?rsd=14020" type=application/rsd+xml 
rel=EditURI><LINK id=commonstyle 
href="无线收发模块PTR8000发送程序 - 斯玛特精品电子工作室 - 中国电子开发网 - Powered by X-Space.files/space.css" 
type=text/css rel=stylesheet><LINK id=themestyle 
href="无线收发模块PTR8000发送程序 - 斯玛特精品电子工作室 - 中国电子开发网 - Powered by X-Space.files/css_14020.cache.css" 
type=text/css rel=stylesheet><LINK id=customizedstyle 
href="无线收发模块PTR8000发送程序 - 斯玛特精品电子工作室 - 中国电子开发网 - Powered by X-Space.files/diy_css_14020.cache.css" 
type=text/css rel=stylesheet>
<SCRIPT type=text/javascript>
var siteUrl = "http://www.cedn.cn";
</SCRIPT>

<SCRIPT language=javascript 
src="无线收发模块PTR8000发送程序 - 斯玛特精品电子工作室 - 中国电子开发网 - Powered by X-Space.files/ajax.js" 
type=text/javascript></SCRIPT>

<SCRIPT language=javascript 
src="无线收发模块PTR8000发送程序 - 斯玛特精品电子工作室 - 中国电子开发网 - Powered by X-Space.files/common.js" 
type=text/javascript></SCRIPT>

<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<DIV id=wrap>
<DIV id=header>
<DIV id=spacename>
<DIV id=xspace-spacename><STRONG>斯玛特精品电子工作室</STRONG> 
<P><A class=xspace-copyurl title=复制地址 
onclick="javascript:setCopy('http://smart.cedn.cn');" 
href="javascript:;">copy</A> <A class=xspace-add2fav title=加入收藏 
onclick="javascript:addBookmark('斯玛特精品电子工作室','http://smart.cedn.cn');return false;" 
href="http://smart.cedn.cn/">Bookmark</A> http://smart.cedn.cn </P></DIV></DIV>
<DIV id=menu>
<UL id=xspace-menu>
  <LI class=xspace-active><A class=xspace-blog 
  href="http://www.cedn.cn/?uid-14020-action-spacelist-type-blog">日志</A> </LI>
  <LI><A class=xspace-goods 
  href="http://www.cedn.cn/?uid-14020-action-spacelist-type-goods">商业城</A> </LI>
  <LI><A class=xspace-file 
  href="http://www.cedn.cn/?uid-14020-action-spacelist-type-file">资料下载</A> </LI>
  <LI><A class=xspace-friend 
  href="http://www.cedn.cn/?uid-14020-action-spacelist-type-friend">好友</A> </LI>
  <LI><A class=xspace-mybbs 
  href="http://www.cedn.cn/?uid-14020-action-spacelist-type-bbs">技术支持</A> </LI>
  <LI><A class=xspace-guestbook 
  href="http://www.cedn.cn/?uid-14020-action-viewpro">留言</A> </LI>
  <LI><A class=xspace-more 
  href="http://www.cedn.cn/?uid-14020-action-spacelist-type-model">更多</A> 
</LI></UL></DIV></DIV>
<DIV class=xspace-layout1 id=content>
<DIV class=mainarea-side id=mainarea>
<DIV id=xspace-guide><A class=xspace-spacecp 
href="http://www.cedn.cn/batch.manage.php?uid=14020" target=_blank>空间管理</A> 
您的位置: <A href="http://www.cedn.cn/" target=_blank>中国电子开发网</A> &raquo; <A 
href="http://www.cedn.cn/?uid-14020">斯玛特精品电子工作室</A> &raquo; <A 
href="http://www.cedn.cn/?uid-14020-action-spacelist-type-blog">日志</A> </DIV>
<DIV id=announcement>1、配合单片机开发板提供技术交流 2、总结自己学习经验 3、提供各种学习资料 </DIV>
<DIV id=show>
<H1 class=xspace-title>无线收发模块PTR8000发送程序</H1>
<P class=xspace-smalltxt><A 
href="http://www.cedn.cn/batch.common.php?action=viewspace&amp;op=up&amp;itemid=1597&amp;uid=14020">上一篇</A> 
/ <A 
href="http://www.cedn.cn/batch.common.php?action=viewspace&amp;op=next&amp;itemid=1597&amp;uid=14020">下一篇</A> 
&nbsp;2007-08-14 00:06:38 / 个人分类:<A 
href="http://www.cedn.cn/?uid-14020-action-spacelist-type-blog-itemtypeid-7">技术积累</A> 
</P>
<DIV class=xspace-itemdata><A 
href="http://www.cedn.cn/?uid-14020-action-viewspace-itemid-1597#xspace-tracks">查看( 
127 )</A> / <A 
href="http://www.cedn.cn/?uid-14020-action-viewspace-itemid-1597#xspace-itemreply">评论( 
0 )</A> / <A 
href="http://www.cedn.cn/?uid-14020-action-viewspace-itemid-1597#xspace-itemform">评分( 
<SPAN class=xspace-rategood title=好评>0</SPAN> / <SPAN class=xspace-ratebad 
title=差评>0</SPAN> )</A> </DIV>
<DIV class=xspace-itemmessage id=xspace-showmessage><SPAN 
style="DISPLAY: none">中国电子开发网Zg)w@g{T</SPAN>
<P>开发硬件平台:新华龙增强型单片机C8051开发板、无线模块PTR8000<SPAN 
style="DISPLAY: none">中国电子开发网,{I7R)b8R'y m(^ ~</SPAN><BR>开发软件平台:KeilC51<SPAN 
style="DISPLAY: none">中国电子开发网1g]{6A4c |</SPAN></P>
<P><SPAN style="DISPLAY: none">g$@%F2og.oM7}0</SPAN>// Header: 
PTR8000模块发射程序<SPAN style="DISPLAY: none">中国电子开发网6Mg1wG5UG`</SPAN><BR>// File 
Name: send.c&nbsp; <SPAN style="DISPLAY: none">中国电子开发网w.UDnV)H</SPAN><BR>// 
Author: Liu Jianhua<SPAN style="DISPLAY: none">中国电子开发网 
zUl2^+v9`6^</SPAN><BR>// Date: 2006-07-14<SPAN style="DISPLAY: none">中国电子开发网F 
Md Y@;tC?:p@</SPAN><BR><BR><SPAN style="DISPLAY: none">~ q d ]:o6w(f 
`0{_0</SPAN>#include "c8051f000.h" <BR><SPAN style="DISPLAY: none">3U-o2ZkmQ 
W0</SPAN>#include "intrins.h" <BR><SPAN 
style="DISPLAY: none">wos4S$x$?,\7X&amp;`0</SPAN>#define uchar unsigned 
char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR><SPAN style="DISPLAY: none">L\@-NQ$C0</SPAN>sbit LED = 
P1^6;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //指示信号<BR><SPAN 
style="DISPLAY: none">b9g+g*r1g#K0</SPAN>sbit SCK = P0^0;<BR><SPAN 
style="DISPLAY: none">1gD8v0i H3Z0</SPAN>sbit MISO= P0^1;<BR><SPAN 
style="DISPLAY: none">[_"a"D L.Q}hpgB0</SPAN>sbit MOSI= P0^2;<SPAN 
style="DISPLAY: none">中国电子开发网&amp;YU,}@_s5r%ZQ</SPAN><BR>sbit DR&nbsp; = 
P0^4;&nbsp;&nbsp;&nbsp;&nbsp; //数据就绪输出<SPAN 
style="DISPLAY: none">中国电子开发网h`_Rm"w)h8n0I</SPAN><BR>sbit CSN = 
P0^5;&nbsp;&nbsp;&nbsp;&nbsp; //SPI使能<SPAN style="DISPLAY: none">中国电子开发网&amp;l$y 
tBR(XoL [</SPAN><BR>sbit CD&nbsp; = P0^6;&nbsp;&nbsp;&nbsp;&nbsp; 
//载波检测输出<SPAN style="DISPLAY: none">中国电子开发网}'q'U:`5_vRYs3G*s 
^#w</SPAN><BR>sbit AM&nbsp; = P0^7;&nbsp;&nbsp;&nbsp;&nbsp; //地址匹配输出<SPAN 
style="DISPLAY: none">中国电子开发网IQ8r-U%l#ED</SPAN><BR>sbit PWR = 
P1^0;&nbsp;&nbsp;&nbsp;&nbsp; //Power Down 模式<BR><SPAN 
style="DISPLAY: none">'RCjX+o B3}4^0</SPAN>sbit 
uPCLK=P1^1;&nbsp;&nbsp;&nbsp;&nbsp; //时钟分频输出<SPAN 
style="DISPLAY: none">中国电子开发网;J}4l8Z/`_ JDe</SPAN><BR>sbit TX_EN= 
P1^2;&nbsp;&nbsp;&nbsp; //‘1’发射模式 ‘0’接收模式<BR><SPAN 
style="DISPLAY: none">*bw*j5A\r3k0</SPAN>sbit TRX_CE=P1^3;&nbsp;&nbsp;&nbsp; 
//使能发射/接收模式<SPAN style="DISPLAY: none">中国电子开发网_^"`$u8Y</SPAN><BR><SPAN 
style="DISPLAY: none">中国电子开发网2zEf(`{y-L</SPAN><BR>void Delay(uchar 
x)<BR><SPAN style="DISPLAY: none">0~D8Aw2pC0</SPAN>{ uchar i;<SPAN 
style="DISPLAY: none">中国电子开发网i yu;m_)N</SPAN><BR>&nbsp;&nbsp;&nbsp; 
for(i=0;i&lt;x;i++)<BR><SPAN 
style="DISPLAY: none">M%kM&amp;x1kni-Y%IX0</SPAN>&nbsp;{<SPAN 
style="DISPLAY: none">中国电子开发网E/f3["d0L)f+C/g?</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp; 
_nop_();<BR><SPAN style="DISPLAY: none">p1T-i1Sg0</SPAN>&nbsp;&nbsp;&nbsp; 
}<SPAN style="DISPLAY: none">中国电子开发网]1~4S#P"T</SPAN><BR>}<SPAN 
style="DISPLAY: none">中国电子开发网 V#Pl9B5Rh3g{</SPAN><BR><BR><SPAN 
style="DISPLAY: none">if {uMy b0</SPAN>void SYSCLK_Init (void)<SPAN 
style="DISPLAY: none">中国电子开发网5J B4i1T O%ygD\:a</SPAN><BR>{ SCICN = 
0x17;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//内部时钟 16MHZ<SPAN style="DISPLAY: none">中国电子开发网*W.Yt|3EvD</SPAN><BR>}<SPAN 
style="DISPLAY: none">中国电子开发网H6|+C s?</SPAN><BR><SPAN 
style="DISPLAY: none">中国电子开发网+QRz0@+v lu</SPAN><BR>void PORT_Init 
(void)<BR><SPAN style="DISPLAY: none">`AM@1F0r0</SPAN>{&nbsp; 
XBR2&nbsp;&nbsp;&nbsp; = 
0x40;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//交叉开关使能,弱上拉使能<BR><SPAN style="DISPLAY: none">{ ze#{"E^0</SPAN>&nbsp;&nbsp; 
PRT0CF |= 
0x2D;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//SCK、MOSI、CSN推挽输出&nbsp; <BR><SPAN style="DISPLAY: none">k&amp;y-| a 
S.{7J,OKd0</SPAN>&nbsp;&nbsp; PRT1CF |= 0xFF;<BR><SPAN 
style="DISPLAY: none">)Af+FG%AwvL&amp;Q0</SPAN>&nbsp;&nbsp; PRT2CF |= 
0xFF;<BR><SPAN style="DISPLAY: none">)f_dU(rQ^0</SPAN>}<SPAN 
style="DISPLAY: none">中国电子开发网:Ww~r;Rr&amp;j6u</SPAN><BR><BR><SPAN 
style="DISPLAY: none">7hKh%tNl P0</SPAN>void SpiWrite(unsigned char 
b)<BR><SPAN style="DISPLAY: none">$Z;](@Z0ccb0</SPAN>{ unsigned char 
i=8;<SPAN style="DISPLAY: none">中国电子开发网1sJd0h v0G K*a 
U</SPAN><BR>&nbsp;&nbsp;&nbsp; while (i--)<BR><SPAN 
style="DISPLAY: none">X_L-]$O$~$TI%O0</SPAN>&nbsp;&nbsp;&nbsp; {<BR><SPAN 
style="DISPLAY: none">F4?y6J#p)h:Kp0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Delay(10);<BR><SPAN 
style="DISPLAY: none">K/C#B7ly;y)Aq2Ze0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SCK=0;<SPAN 
style="DISPLAY: none">中国电子开发网lD$j$b1UYPE</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
MOSI=(bit)(b&amp;0x80);<SPAN 
style="DISPLAY: none">中国电子开发网(f:{T`.L{&amp;J+l</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
b&lt;&lt;=1 ; <SPAN 
style="DISPLAY: none">中国电子开发网ws&amp;DLx&amp;lH_P</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Delay(10);<BR><SPAN 
style="DISPLAY: none">"`)k!Z%I(X!c)hq0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SCK=1; <SPAN style="DISPLAY: none">中国电子开发网"NirHQ?o*Uj 
t</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Delay(10);<BR><SPAN 
style="DISPLAY: none">7KKymJzU+o$?0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SCK=0;<SPAN 
style="DISPLAY: none">中国电子开发网\M&amp;I8yg8b</SPAN><BR>&nbsp;&nbsp;&nbsp; 
}<BR><SPAN style="DISPLAY: none">3O g)F%d6nQ0</SPAN>&nbsp;&nbsp;&nbsp; 
SCK=0;<SPAN style="DISPLAY: none">中国电子开发网1i$u&amp;B _j9oBB 
B</SPAN><BR>}<BR><SPAN style="DISPLAY: none">d4p-Y"v 
C3Z&amp;UW0</SPAN><BR><SPAN 
style="DISPLAY: none">x9k2|N,Y[-I0</SPAN>unsigned char SpiRead(void)<SPAN 
style="DISPLAY: none">中国电子开发网1D H{5{Psv8l-v</SPAN><BR>{&nbsp;&nbsp; register 
unsigned char i=8;<BR><SPAN style="DISPLAY: none">;b 
G,L9|s-WUo0</SPAN>&nbsp;&nbsp;&nbsp; unsigned char ddata=0;<BR><SPAN 
style="DISPLAY: none">O@Yw)_'a k0</SPAN>&nbsp;&nbsp;&nbsp; while (i--)<SPAN 
style="DISPLAY: none">中国电子开发网fV/K;|,r-[X</SPAN><BR>&nbsp;&nbsp;&nbsp; 
{<BR><SPAN style="DISPLAY: none">!M#S 
w5r.KsT0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ddata&lt;&lt;=1 
;<BR><SPAN 
style="DISPLAY: none">u-B%|b)rS0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SCK=0;<BR><SPAN 
style="DISPLAY: none">[3\l.@'qk$pRSb&amp;s0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Delay(20);<SPAN 
style="DISPLAY: none">中国电子开发网0skQb{8i~</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ddata|=MISO;<SPAN style="DISPLAY: none">中国电子开发网"jH`U 
m;O&amp;hJ</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCK=1 
;<BR><SPAN style="DISPLAY: none">r1C} 
L.a0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Delay(20);<BR><SPAN 
style="DISPLAY: none">qI+n!H1z'F0</SPAN>&nbsp;&nbsp;&nbsp; }<SPAN 
style="DISPLAY: none">中国电子开发网1x,mC:NQ.ia</SPAN><BR>&nbsp;&nbsp;&nbsp; 
SCK=0;<SPAN style="DISPLAY: none">中国电子开发网3Rky#w 
ZQ</SPAN><BR>&nbsp;&nbsp;&nbsp; return ddata;<BR><SPAN 
style="DISPLAY: none">bXRe6V3P1ek4K0</SPAN>}<BR><SPAN 
style="DISPLAY: none">Q'A~*VXNF2o4Y*^0</SPAN><SPAN 
style="DISPLAY: none">中国电子开发网)S%zQcCg*H</SPAN><BR>void 
Config905(void)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //配置nRF905 
<BR><SPAN style="DISPLAY: none">"L$|TF S Na0</SPAN>{&nbsp;&nbsp; 
CSN=1;<BR><SPAN style="DISPLAY: none">S L+^PAJpx0</SPAN>&nbsp;&nbsp;&nbsp; 
SCK=0;<BR><SPAN 
style="DISPLAY: none">]8V7b:W-X*H8dLZ0</SPAN>&nbsp;&nbsp;&nbsp; PWR=1;<SPAN 
style="DISPLAY: none">中国电子开发网I]~ z0o k[&amp;~</SPAN><BR>&nbsp;&nbsp;&nbsp; 
TRX_CE=0;<BR><SPAN style="DISPLAY: none">R*|$Y 
I'm+p)nLD0</SPAN>&nbsp;&nbsp;&nbsp; TX_EN=0;<BR><SPAN 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -