Hi Paz,

what exactly doesn't work in your application? I can see you're trying to create a 10ms delay for Comm to get started, before calling send. I'm not sure if you should stop the timer before restarting it for another one shot.

Another thing to try is moving the timer start in SendMsg.sendDone after CommControl.stop(). That's what I had to do to get the timer working in this app.

Regards,

        Harri

At 10:31 AM 2/6/2006 +0100, paz wrote:
Hi Harri,

Ok, I know that the power management functionality is built into MicaZ HPL layer, but I just don't know how to use it. I have been studying the CountSleepRadio example, and trying to modify it to be totally sure that I understand how it works. What I have done is adding it a data read, it compiles but doesn't work.
Do you have any idea on what is happening?

I include the CountSleepRadio  example modified.

Cheers,

Paz





Harri Siirtola escribió:

Hi Paz,

you don't have to include anything from CountSleepRadio. The functionality it uses is built into current MicaZ HPL layer. CountSleepRadio is just an example of how you can achieve power management (stopping certain modules). When your system is "idle enough", power management kicks in by default.

The only "but" is, power management doesn't work in any of the measurement applications (XSensor, XMESH) for MicaZ, if that's what you need. If you write your own applications, you can get it working.

Regards,

        Harri


At 01:16 PM 2/3/2006 +0100, paz wrote:

Hello,

I have a doubt about the use of the "HPLPowerManagement" library.

I've already installed the application called "ContSleepRadio", working fine.

The Makefile has  only these lines:
>>>>>
COMP ?= SleepRadio
COMPONENT ?= Count$(COMP)C
include ../Makerules
<<<<

Now, I developed my application based on how "ContSleepRadio" uses this library, but it does not compile.

Does anybody know any other example of how to use this library?


PD.
I use MICAZ

Thanks in advance,

Paz

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




// $Id: CountSleepRadioC.nc,v 1.4 2005/09/15 00:37:10 jpolastre Exp $
// @author Joe Polastre

includes CountMsg;

/** CountSleepRadio wakes up every 2 seconds, starts the radio,
 * sends a packet with the current count, and then immediately shuts off
 * the radio and UART via the GenericComm StdControl interface.
 * CountSleepRadio is *only* a transmitter, there is no reception ability
 * in this example application.
 */
configuration CountSleepRadioC
{
}
implementation
{
  components Main
           , CountSleepRadioM
           , TimerC
           , GenericComm as Comm
           , LedsC
           ,PhotoTemp//************add this component
// HPLPowerManagement is only needed for AVR based platforms////
#ifdef __AVR__
           , HPLPowerManagementM as PM
#endif
           ;

#ifdef __AVR__
  CountSleepRadioM.PowerManagement -> PM;
  CountSleepRadioM.Enable -> PM.Enable;
#endif

  Main.StdControl -> TimerC;
  Main.StdControl -> CountSleepRadioM;

  CountSleepRadioM.CommControl -> Comm;
  CountSleepRadioM.SendMsg -> Comm.SendMsg[AM_COUNTMSG];
  CountSleepRadioM.Timer -> TimerC.Timer[unique("Timer")];
  CountSleepRadioM.Leds -> LedsC.Leds;


  CountSleepRadioM.Light   -> PhotoTemp.ExternalPhotoADC;
  CountSleepRadioM.LightStdControl   -> PhotoTemp.PhotoStdControl;

}

// $Id: CountSleepRadioM.nc,v 1.5 2005/04/11 05:20:18 jpolastre Exp $
// @author Joe Polastre

includes CountMsg;
includes Timer;

module CountSleepRadioM
{
  provides interface StdControl;
  uses interface Timer;
  uses interface Leds;
  uses interface ADC as Light;  //this line is my
  uses interface StdControl as CommControl;
  uses interface StdControl as LightStdControl;
  uses interface SendMsg;
// these are only needed for Atmel AVR based platforms
#ifdef __AVR__
  uses interface PowerManagement;
  uses command result_t Enable();
#endif
}
implementation
{

  TOS_Msg m_msg;
  bool m_sending, start;

  command result_t StdControl.init()
  {
    m_sending = FALSE;
    start = FALSE;
#ifdef __AVR__
    call Enable();
    call PowerManagement.adjustPower();
#endif
    call Leds.init();
    call CommControl.init();
    call LightStdControl.init();
    return SUCCESS;
  }

  command result_t StdControl.start()
  {
    call Timer.start( TIMER_ONE_SHOT, 2000 );
    return SUCCESS;
  }

  command result_t StdControl.stop()
  {
    return SUCCESS;
  }

  event result_t Timer.fired()
  {
    if( ( m_sending == FALSE ) && (start == FALSE) )
                call Light.getData();
    else if ( ( m_sending == FALSE ) && (start == TRUE) )
    {
if( call SendMsg.send( TOS_BCAST_ADDR, sizeof(CountMsg_t), &m_msg ) == SUCCESS )
      {
          call Leds.yellowOn();
        m_sending = TRUE;
      }
    }
    return SUCCESS;
  }
  async event result_t Light.dataReady (uint16_t data)
  {
     CountMsg_t* body = (CountMsg_t*)m_msg.data;
      body->n = data >> 2;
      body->src = TOS_LOCAL_ADDRESS;
      call Leds.redOn();
      call LightStdControl.stop();
      call CommControl.start();
      start = TRUE;
      call Timer.start(TIMER_ONE_SHOT, 10);

  }
  event result_t SendMsg.sendDone( TOS_MsgPtr msg, result_t success )
  {
    m_sending = FALSE;
    start = FALSE;
    call Timer.start(TIMER_ONE_SHOT, 2000);
    call CommControl.stop();
    call Leds.redOff ();
    call Leds.yellowOff();
    return SUCCESS;
  }

}

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to