[Tinyos-help] MoteIF object problems

2006-04-25 Thread Gelu Contiu
Hi all

 I have a question regarding the way the MoteIF
objects can be used. I need to create a MoteIf object
and then I must change its settings... for example I
must send a message to another mote, on another COM,
but I can't do that using the same MoteIf object. 

 Can I destroy everything that the first MoteIF object
has created ?

This is the way I create my MoteIF object

  PhoenixSource source =
BuildSource.makePhoenix([EMAIL PROTECTED]:tmote,
PrintStreamMessenger err);
 MoteIF moteif = new MoteIF(source) 


 Do you have any suggestions ?

Thanks
Gelu

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] MoteIF object problems

2006-04-25 Thread Michael Schippling

You should be able to create multiple MoteIF objects
with different settings and use them, if not simultaneously,
at least sequentially. Is that the question?

MS

Gelu Contiu wrote:

Hi all

 I have a question regarding the way the MoteIF
objects can be used. I need to create a MoteIf object
and then I must change its settings... for example I
must send a message to another mote, on another COM,
but I can't do that using the same MoteIf object. 


 Can I destroy everything that the first MoteIF object
has created ?

This is the way I create my MoteIF object

  PhoenixSource source =
BuildSource.makePhoenix([EMAIL PROTECTED]:tmote,
PrintStreamMessenger err);
 MoteIF moteif = new MoteIF(source) 



 Do you have any suggestions ?

Thanks
Gelu

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___

Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] MoteIF object problems

2006-04-25 Thread Gregory A. Moore

Hi All,

I have perused the archives about this pesky timed mica2 sleep problem  
and have not found any code snippets or anything of huge benifit.


So I repeat the question:
I am working with Mica2.
I would like to put the mote's CPU to sleep for a set period of time  
and then have it awoken by some timer, not an incomming radio packet.


I have done the power measurements with the use of HPPowerManagementM  
and I have not gotten any successful current readings that show me  
that the module is doing anything in the way of sleeping.


The code from Berkely's study for P-TOSSIM shows us how to set the  
mote's CPU to sleep, but it does not show us how to wake it up with a  
timer.


I write nesC well, but I am not an experienced embedded programmer so  
I am not quite sure how to program the awake tasks from the schematics.


I hope there is someone out there who can help me with my woes.

The code snippet I am using to put the mote to sleep is at the end of  
this email.


Thank you in advance,

Greg


Successful code. thanks to Berkely folks, to put the mote to sleep:

task void gotoSleep() {
  cli();
  //fires the interupt pin to signal data recording
  //This is PIN5 on the connector, use probe to read signal
  TOSH_SET_INT1_PIN();
  TOSH_CLR_INT1_PIN();

  // set the PA_POW to 00h to ensure lowest possible leakage current
  call CC1000Control.SetRFPower(0x00);

  // power down the radio
  call CC1000StdControl.stop();
  //call CC1000RadioIntM.StdControl.stop();
  //call HPLPowerManagement.adjustPower()


  ///Code taken from Snooze.nc,  this is current code used to
  //put the Mica2 into different low power states
  // save port state
  port[0] = inp(PORTA); nops(8);
  port[1] = inp(PORTB); nops(8);
  port[2] = inp(PORTC); nops(8);
  port[3] = inp(PORTD); nops(8);
  port[4] = inp(PORTE); nops(8);
  port[5] = inp(DDRA);  nops(8);
  port[6] = inp(DDRB);  nops(8);
  port[7] = inp(DDRD);  nops(8);
  port[8] = inp(DDRE);  nops(8);
  port[9] = inp(TCCR0); nops(8);
  // Disable TC0 interrupt and set timer/counter0
  //to be asynchronous from the CPU
  // clock with a second external clock (32,768kHz) driving it.
  //Prescale to 32 Hz.
  cbi(TIMSK, OCIE0);  nops(8);

  // set minimum power state
  // NOTE: this enables pull-ups;
  //   -may be sensor board dependant
  //   - (ex: Port C should be lo during sleep, not hi?)

  outp(0x00, DDRA); // input
  outp(0x01, DDRB); // input

  // changed 00 to ff because the impedance was high in the sleep
  // state, drawing 8mA for 5 sec before sleeping. Now it immediately
  // snoozes.
  outp(0xff, DDRC); // input
  outp(0x00, DDRD); // input
  outp(0x00, DDRE); // input

  outp(0xff, PORTA);// enable pull-ups
  outp(0xfe, PORTB);  // enable pull-ups except for PB0

  // changed the value of PORTC from ff to 0 because ff
  // sounds the alarm when the mote goes to sleep.
  outp(0x00, PORTC);// enable pull-ups
  outp(0xff, PORTD);// enable pull-ups

  cbi(ADCSRA, ADEN); //  disable adc
  sbi(ACSR,ACD); //  disable analog comparator

  //goes into sleep modes
  if (sm2 == 1){
sbi(MCUCR, SM2); nops(8);
  }
  if (sm1 == 1){
sbi(MCUCR, SM1); nops(8);
  }
  if (sm0 == 1){
sbi(MCUCR, SM0); nops(8);
  }

  //enable sleep, clocks stop
  sbi(MCUCR, SE);  nops(8);

  //enable interupts (after wakingup - if you do)
  sei(); nops(8);
  //fires the red LED, and the pin
  TOSH_SET_INT1_PIN();
  call Leds.redOn();
}





___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help