[Tinyos-help] [Fwd: Re: [Tinyos-2-commits] i need help for uart interface with micaz motes]

moorthyd at ee.iitb.ac.in moorthyd at ee.iitb.ac.in
Wed Jun 6 21:47:52 PDT 2007


---------------------------- Original Message ----------------------------
Subject: Re: [Tinyos-2-commits] i need help for uart interface with micaz
motes From:    "Philip Levis" <pal at cs.stanford.edu>
Date:    Thu, June 7, 2007 1:21 am
To:      moorthyd at ee.iitb.ac.in
--------------------------------------------------------------------------

Please send questions to tinyos-help.

Phil

On Jun 5, 2007, at 4:53 AM, moorthyd at ee.iitb.ac.in wrote:

> hi all,
>
> i need help to solve uart interface with micaz motes. here i am   attached
> mu program.
>
> -----------------------
> configuration file
> -------------------------
> #include "hardware.h"
> #include <Atm128Uart.h>
> configuration   LeafAppc {
>
>
> 	}
>
> implementation
>
> {
> 	components LedsC,MainC,HplAtm128UartC,Atm128Uart0C,LeafAppcM ;
>
>
> 	 LeafAppcM -> MainC.Boot;
> 	LeafAppcM.Leds -> LedsC;
>
>
>
> 	LeafAppcM. HplUart0 ->HplAtm128UartC.HplUart0 ;
>
> 	LeafAppcM. Uart0RxControl->HplAtm128UartC.Uart0RxControl;
>
> 	LeafAppcM. Uart0TxControl ->HplAtm128UartC.Uart0TxControl;
>
>
>
> 	LeafAppcM.UartByte ->Atm128Uart0C;
>
> 	LeafAppcM.UartStream ->Atm128Uart0C;
>
>
>
> }
>
> -----------------------------------
> module implementation file
> ------------------------------
>
>
>
>
> module LeafAppcM
>
> {
>
>
> 		provides
> 			{
> 				interface StdControl;
> 			}
>
> 		uses
> 			{   interface Boot;
> 				interface Leds;
>
> 				interface HplAtm128Uart as HplUart0;
> 				interface StdControl as Uart0RxControl;
> 				interface StdControl as Uart0TxControl;
>
> 				interface UartByte;
> 				interface UartStream;
>
>
>
> 			}
>
>
>
> }
>
>
>
> implementation 	{
>
>
>
>
> uint8_t rxbuf[25] ;
> uint16_t len_buf = 16;
> uint8_t bit=55;
>
> event void Boot.booted()
>
>   {
>
> 	call Leds.led2On();
>
>
>   }
> command error_t StdControl.start()
> 	{
>
> 		call Leds.led2On();
>
> 		call Uart0TxControl.start();
> 		call Uart0RxControl.start();
> 		call UartStream.enableReceiveInterrupt();
> 		call HplUart0. enableRxIntr();
> 		call HplUart0. enableTxIntr();
>
> 		if (call HplUart0.isTxEmpty())
> 		 {
> 		   call HplUart0.enableTxCIE();
> 		   call Leds.led1On();
> 		   call  HplUart0.tx( bit);
> 		   }
>
> 	}
>
> 	command error_t StdControl.stop()
> 	{
> 		call Uart0TxControl.stop();
> 		call Uart0RxControl.stop();
> 		call HplUart0. disableRxIntr();
> 		call HplUart0. disableTxIntr();
> 		call HplUart0.disableTxCIE();
> 		call UartStream.disableReceiveInterrupt();
> 		call Leds.led1On();
> 		return SUCCESS;
> 	}
>
> 	async event void HplUart0.rxDone(uint8_t data)
> 	{
> 	}
> 	async event void HplUart0.txDone()
> 	{
> 	//call Leds.led2On();
> 	}
> 	async event void UartStream.receivedByte(uint8_t byte)
> 	{
> 	}
>
> 	async event void UartStream. receiveDone(uint8_t *buf, uint16_t len,
> error_t error)
> 	{
> 		if (error== SUCCESS)
> 			{
> 			call Leds.led1Toggle();
> 			}
> 	}
>
> 	async event void UartStream.sendDone(uint8_t *buf, uint16_t len,
> error_t
> error)
> 		{
> 		if (error== SUCCESS)
> 			{
> 			call Leds.led2Toggle();
> 			}
> 		}
>
>
> }
>
>
> <LeafAppc.nc>
> <LeafAppcM.nc>
> _______________________________________________
> Tinyos-2-commits mailing list
> Tinyos-2-commits at mail.millennium.berkeley.edu
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/
> tinyos-2-commits





More information about the Tinyos-help mailing list