[Tinyos-help] PWM Signals

Michael Schippling schip at santafe.edu
Thu Sep 8 10:32:07 PDT 2005


There is a UARTM.nc module that does the actual serial control,
and the GenericComm module that sits on top and sends TOSMsg
packets, which would be a "no fun" situation for printf()s...
As long as you stick with the serial port, connecting your
code into the UART stuff is probably the way to go.

For PWM, I posted some code to this list a month or two ago.
The contrib/cotsbots code has an example running on a
sepatate co-processor that can be used as a guide as well.

good luck Mr. Phelps
MS


Kenneth Lima wrote:
> 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. 
> <http://store.yahoo.com/redcross-donate3/>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


More information about the Tinyos-help mailing list