Hi Sofia! I know the atmega1281 timers in and out, I am rewriting the timer subsystem (or at least I am writing a new one for the atmega128rfa1).
On Wed, Jan 26, 2011 at 4:01 PM, sofia aparicio <[email protected]> wrote: > Hello, > > I would like to configure in Fast PWM mode without prescaler and > toggling OCR3A,OCR3B and OCR3C at the same time. I do the following: > > SET_BIT(DDRE,3); OCR3A > SET_BIT(PORTE,3); > SET_BIT(DDRE,4); OCR3B > SET_BIT(PORTE,4); > SET_BIT(DDRE,5); OCR3C > SET_BIT(PORTE,5); Seems ok, but not sure how you access those pins. How did you verified that your code does not work? You cannot be sure that these pins are available on the 51-pins. > TCCR3A=0x57; COM3A = 1: toggle pin on compare match COM3B = 1: toggle pin on compare match COM3C = 2: clear pin on compare match WGM3:10 = 1 > TCCR3B=0x19; ICNC3 = 0: input capture noise canceler disabled ICES1 = 0: input capture falling edge CS3 = 1: clock running with no prescaling WGM3:32 = 3, therefore WGM3 = 0xD: reserved. This is completely wrong. You want to set WGM3 = 0xC: clear timer on compare, but this uses the ICR3 register to define the top value, or WGM3 = 4 (CTC with OCR3A defining the top value) > OCR3A=0x3E8; > OCR3B=0x5B; > OCR3C=1; > > The OC3A is working well but OC3B and OC3C are not working. Do you what it > is the problem? Do I need to configure an extra bit to use the three output > compares? Should work fine. But the big question: how did you check that it is working. By the way, the Atmega1281 has timer 4 and 5 as well! If possible, I suggest you to use Timer/Counter 4 or 5, as no other code uses that (Timer3 was used instead of Timer1 on the MicaZ and Mica2 motes ,so there could be codes that uses that) > Thank you very much. Best, Miklos > > Sofia > > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
