From: Chris S. <chr...@gm...> - 2006-04-10 02:18:43
|
Dave and company I'm trying to get 3 PWMs working from the gumstix on the robostix. I've got two, but the Atmel PWM controller is a nightmare. This is what I have so far for 1A and 3C. All of the PWM pins are output enabled. But the Atmel timers are all intertwined. They are wierd. I just want another square wave at about 1000Hz. Anything simple that I'm missing? Chris int tccr1a =3D (1 << COM1A1) | (0 << COM1A0) // ChanA, non-inverting PWM, 244.14 Hz | (0 << WGM13) | (0 << WGM12) | (0 << WGM11) | (1 << WGM10); // PWM, Phase Correct, 10-bi= t; int tccr1b =3D (0 << WGM13) | (1 << WGM12) | (1 << CS22) | (0 << CS21) | (0 << CS20); // prescale =3D 6= 4 int tccr3a =3D (1 << COM3C1) | (0 << COM3C0) // ChanC, non-inverting PWM, 976.5625 Hz | (0 << WGM33) | (0 << WGM32) | (0 << WGM31) | (1 << WGM30); // PWM, Phase Correct, 10-bi= t int tccr3b =3D (0 << WGM33) | (1 << WGM32) | (0 << CS22) | (1 << CS21) | (1 << CS20); // prescale =3D 8 int8_t tt; // Init Timer 1 for Steering PWM 1A WRITE_REG8(TCCR1A, tccr1a); WRITE_REG8(TCCR1B, tccr1b); WRITE_REG16(OCR1A, STEERING_MIDDLE); // Init Timer 3 for Motor PWM 3C WRITE_REG8(TCCR3A, tccr3a); WRITE_REG8(TCCR3B, tccr3b); WRITE_REG16(OCR3C, SPEED_OFF); |