Hi Steve,

Thanks alot for the help and the code.
I'm using the mica2 mote(and if i'm not wrong it uses the cc1000 chipcon for 
radio),
so do you think it is compatible?
as you probably know the interfaces are not the same at all bet. the cc2420 and 
cc1000,
so i'm not so sure what i can do.

for you help i'll be grateful

Itamar

----- Original Message -----
From: Steve McKown <[EMAIL PROTECTED]>
Date: Monday, May 21, 2007 23:33
Subject: Re: [Tinyos-help] Allocating address to a mote using the 
ActiveMessageAddressC component
To: [email protected]
Cc: Itamar Amsili <[EMAIL PROTECTED]>

> On Monday 21 May 2007 06:23, Itamar Amsili wrote:
> > I need to allocate a new address to a new mote who joined the 
> network,> (or maybe change a mote's ID from 1 to 2).
> > I want to do the allocation inside the program (dymanic), and 
> i think i
> > need to use the ActiveMessageAddressC component.
> > Do i need to use the ActiveMessageAddressC ? and how to use it?
> > Can one shows me that?
> > And if not using the ActiveMessageAddressC, what other options 
> do i have?
> 
> I'm using ActiveMessageAddressC and it mostly works.  The 
> CC2420 radio knows 
> about the node address but doesn't get notified on changes via 
> setAmAddress(), so the code snippets below deal with that 
> issue.  I suspect 
> the notification issue may affect other radios, but haven't 
> investigated 
> them.
> 
> wiring:
>   components YourModule, ActiveMessageAddressC;
>   YourModule.amAddress -> ActiveMessageAddressC;
> 
>   components CC2420ControlC;
>   YourModule.CC2420Config -> CC2420ControlC;
> 
> In a module:
>   /* to get am_addr_t if not already included */
>   #include "/opt/tinyos-2.x/tos/types/message.h"
> 
>   uses interface CC2420Config;
>   uses sync command void setAmAddress(am_addr_t a);
> 
> then in the implementation somewhere:
>   someFunction(am_addr_t addr)
>   {
>     atomic {
>       call setAmAddress(addr);
>       TOS_NODE_ID = addr;
>     }
>     call CC2420Config.setShortAddr(addr);
>     call CC2420Config.sync();
>   }
> 
>   event void CC2420Config.syncDone(error_t err)
>   {
>     /* The radio has completed the change */
>   }
> 
> 
> PS - Thanks go to David Moss, who helped me work through this 
> solution a 
> couple of weeks ago, on this list.
> 
> Steve
> ‎
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to