Dual 25kHz PWM using Timer1 ...
//Dual 25kHz PWM using Timer1 Mode 10
word pwmA = 160; // 50% duty (0-320 = 0-100% duty cycle)
word pwmB = 288; // 90% duty (0-320 = 0-100% duty cycle)
void setup() {
pinMode(9, OUTPUT); //pwmA
pinMode(10, OUTPUT); //pwmB
TCCR1A = 0; //clear timer registers
TCCR1B = 0;
TCNT1 = 0;
TCCR1B |= _BV(CS10); //no prescaler
ICR1 = 320; //PWM mode counts up 320 then down 320 counts (25kHz)
OCR1A = pwmA; //0-320 = 0-100% duty cycle
TCCR1A |= _BV(COM1A1); //output A clear rising/set falling
OCR1B = pwmB; //0-320 = 0-100% duty cycle
TCCR1A |= _BV(COM1B1); //output B clear rising/set falling
TCCR1B |= _BV(WGM13); //PWM mode with ICR1 Mode 10
TCCR1A |= _BV(WGM11); //WGM13:WGM10 set 1010
}
void loop() {}