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

📄 无线收发模块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-1598 -->
<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="单片机 " name=keywords>
<META 
content="开发硬件平台:新华龙增强型单片机C8051开发板、无线模块PTR8000开发软件平台:KeilC51// Header: PTR8000模块接收程序// File Name: reveive.c // Author: Liu Jianhua// Date: 2006-07-14#include c8051f000.h . " 
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=1598&amp;uid=14020">上一篇</A> 
/ <A 
href="http://www.cedn.cn/batch.common.php?action=viewspace&amp;op=next&amp;itemid=1598&amp;uid=14020">下一篇</A> 
&nbsp;2007-08-14 00:10:23 / 个人分类:<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-1598#xspace-tracks">查看( 
127 )</A> / <A 
href="http://www.cedn.cn/?uid-14020-action-viewspace-itemid-1598#xspace-itemreply">评论( 
3 )</A> / <A 
href="http://www.cedn.cn/?uid-14020-action-viewspace-itemid-1598#xspace-itemform">评分( 
<SPAN class=xspace-rategood title=好评>2</SPAN> / <SPAN class=xspace-ratebad 
title=差评>0</SPAN> )</A> </DIV>
<DIV class=xspace-itemmessage id=xspace-showmessage>
<P><SPAN 
style="DISPLAY: none">D%kA,n9a\0</SPAN>开发硬件平台:新华龙增强型单片机C8051开发板、无线模块PTR8000<SPAN 
style="DISPLAY: none">中国电子开发网/z N%MK8T)B*f%X3}&amp;[ 
O2};?</SPAN><BR>开发软件平台:KeilC51</P><SPAN style="DISPLAY: none">#[Q)TgO*Xq 
SQ0</SPAN> <SPAN style="DISPLAY: none">中国电子开发网3_kj"J&amp;`#|m</SPAN>
<P>// Header:&nbsp;&nbsp;&nbsp; PTR8000模块接收程序<SPAN style="DISPLAY: none">中国电子开发网 
o$SJd*buMC</SPAN><BR>// File Name: reveive.c&nbsp; <SPAN 
style="DISPLAY: none">中国电子开发网 sXdNWk</SPAN><BR>// Author:&nbsp;&nbsp;&nbsp; 
Liu Jianhua<BR><SPAN style="DISPLAY: none">Kj#W.B._GS0</SPAN>// 
Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2006-07-14<BR><SPAN 
style="DISPLAY: none">\`W$z.p&amp;ir0</SPAN><BR><SPAN 
style="DISPLAY: none">'i_qfF#N^ e.g0</SPAN>#include "c8051f000.h" <BR><SPAN 
style="DISPLAY: none">Kp"u;?rp9k0</SPAN>#include "intrins.h" <SPAN 
style="DISPLAY: none">中国电子开发网-U](qks%e!Rx2kC Ru</SPAN><BR>#define uchar 
unsigned 
char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<SPAN style="DISPLAY: none">中国电子开发网1r7FJ"M){:tf N</SPAN><BR>sbit LED = 
P1^6;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//指示信号<BR><SPAN style="DISPLAY: none">P5V/PK#]kz/|9K0</SPAN>sbit SCK = 
P0^0;<SPAN style="DISPLAY: none">中国电子开发网kg7P jJB</SPAN><BR>sbit MISO= 
P0^1;<BR><SPAN style="DISPLAY: none">0Vn x6D GD^0</SPAN>sbit MOSI= P0^2;<SPAN 
style="DISPLAY: none">中国电子开发网_QJ Fq#E8Q:E0PF</SPAN><BR>sbit DR&nbsp; = 
P0^4;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//数据就绪输出<BR><SPAN style="DISPLAY: none">2]\7m7Kh'^ X;Yn0</SPAN>sbit CSN = 
P0^5;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//SPI使能<SPAN style="DISPLAY: none">中国电子开发网x*W.p D!Z&amp;q$A</SPAN><BR>sbit 
CD&nbsp; = 
P0^6;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//载波检测输出<BR><SPAN style="DISPLAY: none">uXnW i&amp;tH1O7R0</SPAN>sbit 
AM&nbsp; = 
P0^7;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//地址匹配输出<SPAN style="DISPLAY: none">中国电子开发网6hqF R%OO@</SPAN><BR>sbit PWR = 
P1^0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//Power Down 模式<SPAN style="DISPLAY: none">中国电子开发网3sf7a:N:G'y</SPAN><BR>sbit 
uPCLK 
=P1^1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//时钟分频输出<SPAN style="DISPLAY: none">中国电子开发网&amp;wPJ7VNa</SPAN><BR>sbit TX_EN 
= 
P1^2;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//‘1’发射模式 ‘0’接收模式<SPAN style="DISPLAY: none">中国电子开发网^8ew6nv 
t:J</SPAN><BR>sbit 
TRX_CE=P1^3;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//使能发射/接收模式<SPAN style="DISPLAY: none">中国电子开发网]/E 
_+jI-pae</SPAN><BR><BR><SPAN style="DISPLAY: none">C$xZF(\)J*xqv 
l0</SPAN>void Delay(uchar x)<SPAN 
style="DISPLAY: none">中国电子开发网\~cPWV6i%z+Z</SPAN><BR>{<SPAN 
style="DISPLAY: none">中国电子开发网WI#m%]ezgS| w&amp;u 
}+`</SPAN><BR>&nbsp;&nbsp;&nbsp; uchar i;<SPAN style="DISPLAY: none">中国电子开发网x2_ 
]'g2J+WuM ZH(y</SPAN><BR>&nbsp;&nbsp;&nbsp; for(i=0;i&lt;x;i++){<BR><SPAN 
style="DISPLAY: none">.H,o 
Qcls2k(Z7Hd0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _nop_();<SPAN 
style="DISPLAY: none">中国电子开发网N5S p(r$u$^D</SPAN><BR>&nbsp;&nbsp;&nbsp; 
}<BR><SPAN style="DISPLAY: none">X'O'c)g6H2{!Az.|f,C6N z0</SPAN>}<SPAN 
style="DISPLAY: none">中国电子开发网FcD$r4m-h5Kz0L</SPAN><BR><SPAN 
style="DISPLAY: none">中国电子开发网q:x`|`9[%z`c_</SPAN><BR>void SYSCLK_Init 
(void)<BR><SPAN style="DISPLAY: none">)eY$|Ko9T/d%\0</SPAN>{ SCICN = 
0x14;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//内部时钟 16MHZ<SPAN style="DISPLAY: none">中国电子开发网9e!\4i/j#~D|</SPAN><BR>}<SPAN 
style="DISPLAY: none">中国电子开发网2HNF6jO#_*O</SPAN><BR><SPAN 
style="DISPLAY: none">中国电子开发网!@g1\:V(U)}</SPAN><BR>void PORT_Init (void)<SPAN 
style="DISPLAY: none">中国电子开发网(hp|:J&amp;xf3g$k</SPAN><BR>{&nbsp; 
XBR2&nbsp;&nbsp;&nbsp; = 
0x40;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//交叉开关使能,弱上拉使能<SPAN style="DISPLAY: none">中国电子开发网 
rXF.@[^:Q,cb</SPAN><BR>&nbsp;&nbsp; PRT0CF |= 
0x2D;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//SCK、MOSI、CSN推挽输出 <SPAN style="DISPLAY: none">中国电子开发网i w(j%tf 
e.QX:~</SPAN><BR>&nbsp;&nbsp; PRT1CF |= 0xFF;<BR><SPAN 
style="DISPLAY: none">-n!oiQ.pW0</SPAN>&nbsp;&nbsp; PRT2CF |= 
0xFF;&nbsp;&nbsp;&nbsp; <SPAN style="DISPLAY: none">中国电子开发网#gA6N/A^ 
b</SPAN><BR>}<SPAN 
style="DISPLAY: none">中国电子开发网)uk?,T#?0M.N9?zG</SPAN><BR><SPAN 
style="DISPLAY: none">中国电子开发网(Z+v3t&amp;r#e(dHg[</SPAN><BR>void 
SpiWrite(unsigned char b)<BR><SPAN style="DISPLAY: none">s\1^0Pm0</SPAN>{<SPAN 
style="DISPLAY: none">中国电子开发网~EI0~ IO/r*Aq</SPAN><BR>&nbsp;&nbsp;&nbsp; 
unsigned char i=8;<SPAN style="DISPLAY: none">中国电子开发网 s|:V%Q)Y'@7b 
y8}</SPAN><BR>&nbsp;&nbsp;&nbsp; while (i--)<SPAN 
style="DISPLAY: none">中国电子开发网B(d Uwy[AF</SPAN><BR>&nbsp;&nbsp;&nbsp; 
{<SPAN style="DISPLAY: none">中国电子开发网!d#NfRNC 
b'z.Xt</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Delay(10);<BR><SPAN 
style="DISPLAY: none">$N4y)P1^4O$w)D]$wV0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SCK=0;<BR><SPAN 
style="DISPLAY: none">A3]'mJx2xY0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
MOSI=(bit)(b&amp;0x80);<SPAN 
style="DISPLAY: none">中国电子开发网FsT0yv</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
b&lt;&lt;=1 ; <BR><SPAN style="DISPLAY: none">+| 
^cZc3Nx0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Delay(10);<BR><SPAN 
style="DISPLAY: none">J6BU 
mYc0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCK=1; <BR><SPAN 
style="DISPLAY: none">~lDP{of!k0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Delay(10);<SPAN style="DISPLAY: none">中国电子开发网2U5ayE)\Ei,l$L 
F</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCK=0;<BR><SPAN 
style="DISPLAY: none">cJ E+_k/]4v0</SPAN>&nbsp;&nbsp;&nbsp; }<BR><SPAN 
style="DISPLAY: none">;nX|Af }P0</SPAN>&nbsp;&nbsp;&nbsp; SCK=0;<SPAN 
style="DISPLAY: none">中国电子开发网3gF0MjG } aF</SPAN><BR>&nbsp;&nbsp;&nbsp; 
Delay(20);<BR><SPAN style="DISPLAY: none">h-Y4{:M$S/|6xyo0</SPAN>}<SPAN 
style="DISPLAY: none">中国电子开发网/O:c0|.OnO?'J-Is</SPAN><BR><SPAN 
style="DISPLAY: none">中国电子开发网2l;mOJ'YV8L2U+e1K3Z</SPAN><BR>unsigned char 
SpiRead(void)<BR><SPAN style="DISPLAY: none">*m5t*A7L Knc0</SPAN>{<SPAN 
style="DISPLAY: none">中国电子开发网`'J l:~C8P</SPAN><BR>&nbsp;&nbsp;&nbsp; register 
unsigned char i=8;<BR><SPAN 
style="DISPLAY: none">8DU5eY7W7w#o0</SPAN>&nbsp;&nbsp;&nbsp; unsigned char 
ddata=0;<SPAN 
style="DISPLAY: none">中国电子开发网&amp;cNrfg</SPAN><BR>&nbsp;&nbsp;&nbsp; while 
(i--)<SPAN style="DISPLAY: none">中国电子开发网z[0y4p2j2D)h6W:L 
Z</SPAN><BR>&nbsp;&nbsp;&nbsp; {<BR><SPAN 
style="DISPLAY: none">'T^A&amp;Nx#Ks:V0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ddata&lt;&lt;=1 ;<SPAN style="DISPLAY: none">中国电子开发网F'o;@,y:],D5a.U 
ZM6X"J</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCK=0;<SPAN 
style="DISPLAY: none">中国电子开发网W1a"t6JO5Vo:p,sN</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Delay(20);<SPAN 
style="DISPLAY: none">中国电子开发网RiXABT"B-TJ</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ddata|=MISO;<BR><SPAN 
style="DISPLAY: none">}[+V5h.d:d?0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SCK=1 ;<BR><SPAN style="DISPLAY: none">IoQ9z.uB2ju 
TT0</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Delay(20);<BR><SPAN 
style="DISPLAY: none">Kg$p3D*`"Mr0</SPAN>&nbsp;&nbsp;&nbsp; }<BR><SPAN 
style="DISPLAY: none">o u:yZXQw^a0</SPAN>&nbsp;&nbsp;&nbsp; SCK=0;<SPAN 
style="DISPLAY: none">中国电子开发网#@2A\C$L'j9o~8?tR</SPAN><BR>&nbsp;&nbsp;&nbsp; 
Delay(20);<SPAN 
style="DISPLAY: none">中国电子开发网(\"`:q%b-_&amp;X</SPAN><BR>&nbsp;&nbsp;&nbsp; 

⌨️ 快捷键说明

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