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

📄 mote-mote radio communication - tinyos documentation wiki.htm

📁 从官方网站上下载tinyos2.0的学习指南
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0062)http://docs.tinyos.net/index.php/Mote-mote_radio_communication -->
<HTML lang=en dir=ltr xml:lang="en" 
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Mote-mote radio communication - TinyOS Documentation Wiki</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<META 
content="Mote-mote radio communication,Mote-mote radio communication,Modules and the TinyOS Execution Model,Mote-PC serial communication and SerialForwarder" 
name=keywords><LINK href="/favicon.ico" rel="shortcut icon"><LINK 
title="TinyOS Documentation Wiki (English)" href="/opensearch_desc.php" 
type=application/opensearchdescription+xml rel=search>
<STYLE type=text/css media="screen, projection">@import url( /skins/common/shared.css?97 );
@import url( /skins/monobook/main.css?97 );
</STYLE>
<LINK media=print 
href="Mote-mote radio communication - TinyOS Documentation Wiki.files/commonPrint.css" 
type=text/css rel=stylesheet><!--[if lt IE 5.5000]><style type="text/css">@import "/skins/monobook/IE50Fixes.css?97";</style><![endif]--><!--[if IE 5.5000]><style type="text/css">@import "/skins/monobook/IE55Fixes.css?97";</style><![endif]--><!--[if IE 6]>
<STYLE type=text/css>@import url( /skins/monobook/IE60Fixes.css?97 );
</STYLE>
<![endif]--><!--[if IE 7]><style type="text/css">@import "/skins/monobook/IE70Fixes.css?97";</style><![endif]--><!--[if lt IE 7]>
<SCRIPT 
src="Mote-mote radio communication - TinyOS Documentation Wiki.files/IEFixes.js" 
type=text/javascript></SCRIPT>

<META http-equiv=imagetoolbar content=no><![endif]-->
<SCRIPT type=text/javascript>/*<![CDATA[*/var skin = "monobook";var stylepath = "/skins";var wgArticlePath = "/index.php/$1";var wgScriptPath = "";var wgScript = "/index.php";var wgServer = "http://docs.tinyos.net";var wgCanonicalNamespace = "";var wgCanonicalSpecialPageName = false;var wgNamespaceNumber = 0;var wgPageName = "Mote-mote_radio_communication";var wgTitle = "Mote-mote radio communication";var wgAction = "view";var wgRestrictionEdit = [];var wgRestrictionMove = [];var wgArticleId = "9";var wgIsArticle = true;var wgUserName = null;var wgUserGroups = null;var wgUserLanguage = "en";var wgContentLanguage = "en";var wgBreakFrames = false;var wgCurRevisionId = "852";/*]]>*/</SCRIPT>

<SCRIPT 
src="Mote-mote radio communication - TinyOS Documentation Wiki.files/wikibits.js" 
type=text/javascript><!-- wikibits js --></SCRIPT>

<SCRIPT 
src="Mote-mote radio communication - TinyOS Documentation Wiki.files/index.php" 
type=text/javascript><!-- site js --></SCRIPT>

<STYLE type=text/css>@import url( /index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000 );
@import url( /index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000 );
@import url( /index.php?title=-&action=raw&gen=css&maxage=18000 );
</STYLE>
<!-- Head Scripts -->
<SCRIPT 
src="Mote-mote radio communication - TinyOS Documentation Wiki.files/ajax.js" 
type=text/javascript></SCRIPT>

<META content="MSHTML 6.00.2900.3268" name=GENERATOR></HEAD>
<BODY class="mediawiki ns-0 ltr page-Mote-mote_radio_communication">
<DIV id=globalWrapper>
<DIV id=column-content>
<DIV id=content><A id=top name=top></A>
<H1 class=firstHeading>Mote-mote radio communication</H1>
<DIV id=bodyContent>
<H3 id=siteSub>From TinyOS Documentation Wiki</H3>
<DIV id=contentSub></DIV>
<DIV id=jump-to-nav>Jump to: <A 
href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#column-one">navigation</A>, 
<A 
href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#searchInput">search</A></DIV><!-- start content -->
<P>This lesson introduces radio communications in TinyOS. You will become 
familar with TinyOS interfaces and components that support communications and 
you will learn how to: </P>
<UL>
  <LI>Use <CODE>message_t</CODE>, the TinyOS 2.0 message buffer. 
  <LI>Send a message buffer to the radio. 
  <LI>Receive a message buffer from the radio. </LI></UL>
<P><BR></P>
<TABLE class=toc id=toc summary=Contents>
  <TBODY>
  <TR>
    <TD>
      <DIV id=toctitle>
      <H2>Contents</H2></DIV>
      <UL>
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Introduction"><SPAN 
        class=tocnumber>1</SPAN> <SPAN class=toctext>Introduction</SPAN></A> 
        <UL>
          <LI class=toclevel-2><A 
          href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Basic_Communications_Interfaces"><SPAN 
          class=tocnumber>1.1</SPAN> <SPAN class=toctext>Basic Communications 
          Interfaces</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Active_Message_Interfaces"><SPAN 
          class=tocnumber>1.2</SPAN> <SPAN class=toctext>Active Message 
          Interfaces</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Components"><SPAN 
          class=tocnumber>1.3</SPAN> <SPAN class=toctext>Components</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Naming_Wrappers"><SPAN 
          class=tocnumber>1.4</SPAN> <SPAN class=toctext>Naming 
          Wrappers</SPAN></A> </LI></UL>
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#The_TinyOS_2.0_Message_Buffer"><SPAN 
        class=tocnumber>2</SPAN> <SPAN class=toctext>The TinyOS 2.0 Message 
        Buffer</SPAN></A> 
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Sending_a_Message_over_the_Radio"><SPAN 
        class=tocnumber>3</SPAN> <SPAN class=toctext>Sending a Message over the 
        Radio</SPAN></A> 
        <UL>
          <LI class=toclevel-2><A 
          href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Reimplementing_Blink"><SPAN 
          class=tocnumber>3.1</SPAN> <SPAN class=toctext>Reimplementing 
          Blink</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Defining_a_Message_Structure"><SPAN 
          class=tocnumber>3.2</SPAN> <SPAN class=toctext>Defining a Message 
          Structure</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Sending_a_Message"><SPAN 
          class=tocnumber>3.3</SPAN> <SPAN class=toctext>Sending a 
          Message</SPAN></A> </LI></UL>
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Receiving_a_Message_over_the_Radio"><SPAN 
        class=tocnumber>4</SPAN> <SPAN class=toctext>Receiving a Message over 
        the Radio</SPAN></A> 
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Conclusions"><SPAN 
        class=tocnumber>5</SPAN> <SPAN class=toctext>Conclusions</SPAN></A> 
        <LI class=toclevel-1><A 
        href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#Related_Documentation"><SPAN 
        class=tocnumber>6</SPAN> <SPAN class=toctext>Related 
        Documentation</SPAN></A> </LI></UL></TD></TR></TBODY></TABLE>
<SCRIPT type=text/javascript> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </SCRIPT>
<A name=Introduction></A>
<H1><SPAN class=mw-headline>Introduction</SPAN></H1>
<P>TinyOS provides a number of <I>interfaces</I> to abstract the underlying 
communications services and a number of <I>components</I> that <I>provide</I> 
(implement) these interfaces. All of these interfaces and components use a 
common message buffer abstraction, called <CODE>message_t</CODE>, which is 
implemented as a nesC struct (similar to a C struct). The <CODE>message_t</CODE> 
abstraction replaces the TinyOS 1.x <CODE>TOS_Msg</CODE> abstraction. Unlike 
TinyOS 1.x, the members of <CODE>message_t</CODE> are opaque, and therefore not 
accessed directly. Rather, <CODE>message_t</CODE> is an <I>abstract data 
type</I>, whose members are read and written using accessor and mutator 
functions <SUP class=reference id=_ref-fn1_0><A title="" 
href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication#_note-fn1">[1]</A></SUP>. 
</P><A name=Basic_Communications_Interfaces></A>
<H2><SPAN class=mw-headline>Basic Communications Interfaces</SPAN></H2>
<P>There are a number of interfaces and components that use 
<CODE>message_t</CODE> as the underlying data structure. Let's take a look at 
some of the interfaces that are in the <CODE>tos/interfaces</CODE> directory to 
familiarize ourselves with the general functionality of the communications 
system: </P>
<UL>
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/interfaces/Packet.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/interfaces/Packet.nc" 
  rel=nofollow>Packet</A></CODE> - Provides the basic accessors for the 
  <CODE>message_t</CODE> abstract data type. This interface provides commands 
  for clearing a message's contents, getting its payload length, and getting a 
  pointer to its payload area. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/interfaces/Send.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/interfaces/Send.nc" 
  rel=nofollow>Send</A></CODE> - Provides the basic <I>address-free</I> message 
  sending interface. This interface provides commands for sending a message and 
  canceling a pending message send. The interface provides an event to indicate 
  whether a message was sent successfully or not. It also provides convenience 
  functions for getting the message's maximum payload as well as a pointer to a 
  message's payload area. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/interfaces/Receive.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/interfaces/Receive.nc" 
  rel=nofollow>Receive</A></CODE> - Provides the basic message reception 
  interface. This interface provides an event for receiving messages. It also 
  provides, for convenience, commands for getting a message's payload length and 
  getting a pointer to a message's payload area. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/interfaces/PacketAcknowledgements.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/interfaces/PacketAcknowledgements.nc" 
  rel=nofollow>PacketAcknowledgements</A></CODE> - Provides a mechanism for 
  requesting acknowledgements on a per-packet basis. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/interfaces/RadioTimeStamping.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/interfaces/RadioTimeStamping.nc" 
  rel=nofollow>RadioTimeStamping</A></CODE> - Provides time stamping information 
  for radio transmission and reception. </LI></UL><A 
name=Active_Message_Interfaces></A>
<H2><SPAN class=mw-headline>Active Message Interfaces</SPAN></H2>
<P>Since it is very common to have multiple services using the same radio to 
communicate, TinyOS provides the Active Message (AM) layer to multiplex access 
to the radio. The term "AM type" refers to the field used for multiplexing. AM 
types are similar in function to the Ethernet frame type field, IP protocol 
field, and the UDP port in that all of them are used to multiplex access to a 
communication service. AM packets also includes a destination field, which 
stores an "AM address" to address packets to particular motes. Additional 
interfaces, also located in the <CODE>tos/interfaces</CODE> directory, were 
introduced to support the AM services: </P>
<UL>
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/interfaces/AMPacket.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/interfaces/AMPacket.nc" 
  rel=nofollow>AMPacket</A></CODE> - Similar to <CODE>Packet</CODE>, provides 
  the basic AM accessors for the <CODE>message_t</CODE> abstract data type. This 
  interface provides commands for getting a node's AM address, an AM packet's 
  destination, and an AM packet's type. Commands are also provides for setting 
  an AM packet's destination and type, and checking whether the destination is 
  the local node. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/interfaces/AMSend.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/interfaces/AMSend.nc" 
  rel=nofollow>AMSend</A></CODE> - Similar to <CODE>Send</CODE>, provides the 
  basic Active Message sending interface. The key difference between 
  <CODE>AMSend</CODE> and <CODE>Send</CODE> is that <CODE>AMSend</CODE> takes a 
  destination AM address in its <CODE>send</CODE> command. </LI></UL>
<P>The AM address of a node can be set at installation time, using the 
<CODE>make install.<I>n</I></CODE> or <CODE>make reinstall.<I>n</I></CODE> 
commands. It can be changed at runtime using the 
<CODE>ActiveMessageAddressC</CODE> component (see below). </P><A 
name=Components></A>
<H2><SPAN class=mw-headline>Components</SPAN></H2>
<P>A number of components implement the basic communications and active message 
interfaces. Let's take a look at some of the components in the 
<CODE>/tos/system</CODE> directory. You should be familiar with these components 
because your code needs to specify both the <I>interfaces</I> your application 
<I>uses</I> as well as the <I>components</I> which <I>provide</I> (implement) 
those interfaces: </P>
<UL>
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/system/AMReceiverC.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/system/AMReceiverC.nc" 
  rel=nofollow>AMReceiverC</A></CODE> - Provides the following interfaces: 
  <CODE>Receive</CODE>, <CODE>Packet</CODE>, and <CODE>AMPacket</CODE>. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/system/AMSenderC.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/system/AMSenderC.nc" 
  rel=nofollow>AMSenderC</A></CODE> - Provides <CODE>AMSend</CODE>, 
  <CODE>Packet</CODE>, <CODE>AMPacket</CODE>, and 
  <CODE>PacketAcknowledgements</CODE> as <CODE>Acks</CODE>. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/system/AMSnooperC.nc 
  href="http://www.tinyos.net/tinyos-2.x/tos/system/AMSnooperC.nc" 
  rel=nofollow>AMSnooperC</A></CODE> - Provides <CODE>Receive</CODE>, 
  <CODE>Packet</CODE>, and <CODE>AMPacket</CODE>. 
  <LI><CODE><A class="external text" 
  title=http://www.tinyos.net/tinyos-2.x/tos/system/AMSnoopingReceiverC.nc 

⌨️ 快捷键说明

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