hi,
I have modified blinkToRadio code to send a packet to base station whenever 
there is an interrupt on port 27 of msp430 (Tmote Sky).
And if there is no interrupt then after 10000 ms node sends its battey voltage.

I am getting following warnings

/opt/msp430/msp430/include/msp430/gpio.h:141: warning: non-atomic accesses to 
shared variable `P2IFG':
/opt/tinyos-2.x/tos/chips/msp430/pins/HplMsp430InterruptP.nc:202: warning:   
non-atomic r/w
/opt/msp430/msp430/include/msp430/gpio.h:145: warning: non-atomic accesses to 
shared variable `P2IE':
/opt/tinyos-2.x/tos/chips/msp430/pins/HplMsp430InterruptP.nc:186: warning:   
non-atomic r/w

my code is as followes:

1. BlinkToRadio.h


#ifndef BLINKTORADIO_H
#define BLINKTORADIO_H

enum {
  AM_BLINKTORADIO = 6,
  TIMER_PERIOD_MILLI = 10000,
  STATE_TIME = 50
};

typedef nx_struct BlinkToRadioMsg {
  nx_uint16_t nodeid;
  nx_uint16_t portid[2];
} BlinkToRadioMsg;

#endif

2. BlinkToRadioAppC.nc

#include <Timer.h>
#include "BlinkToRadio.h"

configuration BlinkToRadioAppC {
}
implementation {
  components MainC;
  components LedsC;
  components HplMsp430InterruptC;
  components BlinkToRadioC as App;
  components new TimerMilliC() as Timer0;
  components ActiveMessageC;
  components new AMSenderC(AM_BLINKTORADIO);
  components new DemoSensorC() as Sensor;

  App.Boot -> MainC;
  App.Leds -> LedsC;
  App.Timer0 -> Timer0;
  App.PORTa ->HplMsp430InterruptC.Port27;
  App.Packet -> AMSenderC;
  App.AMPacket -> AMSenderC;
  App.AMControl -> ActiveMessageC;
  App.AMSend -> AMSenderC;
  App.Read -> Sensor;
}

3. BlinkToRadioC.nc
#include <Timer.h>
#include "BlinkToRadio.h"

module BlinkToRadioC {
  uses interface Boot;
  uses interface Leds;
  uses interface Timer<TMilli> as Timer0;
  uses interface HplMsp430Interrupt as PORTa;
  uses interface Read<uint16_t>;
  uses interface Packet;
  uses interface AMPacket;
  uses interface AMSend;
  uses interface SplitControl as AMControl;
}
implementation {

  message_t pkt;
  bool busy = FALSE;
  BlinkToRadioMsg* btrpkt;
  task void portfiredTask();

void portFired(){
    if (!busy) {
              btrpkt = 
               (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL));
              btrpkt->nodeid = TOS_NODE_ID;
        btrpkt->portid[0] = 1;
        call Read.read();
    }
}

void sendarr(){
    
    if (call AMSend.send(AM_BROADCAST_ADDR, 
        &pkt, sizeof(BlinkToRadioMsg)) == SUCCESS) {
        busy = TRUE;
          }
}

task void portfiredTask() { portFired(); }

  event void Boot.booted() {
    call AMControl.start();
  }

  event void AMControl.startDone(error_t err) {
    if (err == SUCCESS) {
      call PORTa.enable();
      call Timer0.startPeriodic(TIMER_PERIOD_MILLI);
    }
    else {
      call AMControl.start();
    }
  }

  event void AMControl.stopDone(error_t err) {
  }


 async event void PORTa.fired()
 {
    post portfiredTask();    
}

event void Timer0.fired() {

    if (!busy) {
          btrpkt = 
           (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL));
          btrpkt->nodeid = TOS_NODE_ID;
    btrpkt->portid[0] = 0;
    call Read.read();
    }
}

 
event void Read.readDone(error_t result, uint16_t data) {
    if (result == SUCCESS)
   {
    btrpkt->portid[2] = data;
    sendarr();
  }
}

  event void AMSend.sendDone(message_t* msg, error_t err) {
    if (&pkt == msg) {
    call Leds.led0Toggle();
          busy = FALSE;
    call PORTa.clear();
    }
  }

 
}


Can any one help me in removing above warnings.

Thanks
  

Gaurav Mathur 
D-54 Karakoram Hostel
IIT Delhi
Ph. 9911809832
Email : 
[EMAIL PROTECTED]
[EMAIL PROTECTED]






      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to