[Tinyos-help] PWM Signals

Kenneth Lima kglima at yahoo.com
Wed Sep 7 06:56:38 PDT 2005


Hi ,
 
I have switched to TinyOS and I am interested in creating a 40 Khz PWM signal with Timer1 on the ATMEGA128 Microcontroller with NESC. My program looks like this in avr.
 
void init_sender(void){
 //40kHz Signal
  TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(COM1B0) | _BV (WGM11);
  TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV (CS10); //Starts generating PWM 
       
   ICR1 = 200;        // 200 * (1/8Mhz)= 25us 
   OCR1A = 100;    // 50% duty cycle     
                               
   TIMSK = _BV (TOIE1)  ;     // Overflow interupt 1
   sei();      
}
 
int main (void) {       
       /* Init Sender */
        init_sender();
 return 0;
}
 
This creates a 40khz pWM signal on PB5. Please i would be glad to get a hint on how i can test this simple program in nesc? 
 
Thanks 
Kenneth

		
---------------------------------
 Click here to donate to the Hurricane Katrina relief effort.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20050907/57983e04/attachment.htm


More information about the Tinyos-help mailing list