[Tinyos-help] HOW TO DISPLAY MESSAGES FROM MOTE TO PC

weiyao at bu.edu weiyao at bu.edu
Wed Mar 2 12:00:07 PST 2005


Hi Santos,

You can use the componet HPLUARTC which allows your mote to communicate with 
PC via seral port.

The following is what I did. with this program, the mote will send "ff"to pc 
erery second, if you send a number to the mote via serial port, it will send 
back (number+1) to pc.

Regards,
weiyao


configuration UartComm{
   
}

implementation {
  components Main, UartCommM, SingleTimer, HPLUARTC;
  
  Main.StdControl -> UartCommM.StdControl;
  Main.StdControl -> SingleTimer.StdControl;
  
  
  UartCommM.Timer -> SingleTimer.Timer;
  UartCommM.UART -> HPLUARTC.UART; 
  
}

module UartCommM {
  provides {
    interface StdControl;
	//interface SendMsgToUART; 
  }
  uses {
    interface HPLUART as UART;
	interface Timer;
  }
}

implementation {
  
  command result_t StdControl.init() {
    call UART.init();
	return SUCCESS;
  }
  
  command result_t StdControl.start() {
    //call UART.start();
	call Timer.start(TIMER_REPEAT, 1000);
	return SUCCESS;
  }
  
  command result_t StdControl.stop() {
    call UART.stop();
	call Timer.stop();
	return SUCCESS;
  }
  
  event result_t Timer.fired() {
       
	  call UART.put(255);
	  return SUCCESS;
   }  
  
  async event result_t UART.get(uint8_t data) { 
    call UART.put(data+1);
	return SUCCESS; }
  
  async event result_t UART.putDone() { return SUCCESS; }
  
}






>Message: 4
>Date: Wed, 02 Mar 2005 12:33:27 +0800
>From: santos <skdas at i2r.a-star.edu.sg>
>Subject: Re: [Tinyos-help] HOW TO DISPLAY  MESSAGES FROM MOTE TO PC
>To: tinyos-help at Millennium.Berkeley.EDU
>Message-ID: <42254217.000005.02792 at lit-gz5li9ui5ca>
>Content-Type: Text/Plain
>
>
>Hi,

>Could any body please suggest for the following. 
>
>I want to send a Hello message from PC to mote and want to receive and
>display the the same hello message in PC. 
>
>How can I write nesc programming for this??
>
>Thank you,
>Regards,
>Santos
 


More information about the Tinyos-help mailing list