I can't seem to get my timer1 to enable on compare match to drive two motors. One at PD5 and one on PD6. It is driving me crazy. Please help.
ISR(TIMER1_COMPA_vect)
{
PORTD ^= (1<<PIND5);
}
ISR(TIMER1_COMPB_vect)
{
PORTD ^= (1<<PIND6);
}
// All initializations
void initialize_all()
{
sei();
DDRD = 0b11110100; //set the output pins to control the motors
DDRB = 0b00100001; //more motor control
PORTB = !(1<<PINB5); //onboard led off
PORTD |= (1<<PIND2); // SPIN FORWARD
PORTB |= (1<<PINB0); //SPIN FORWARD
TCCR1A = (1<<COM1A1) | (1 << COM1B1) | (1 << WGM13) | (0 << WGM12) | (0 << WGM11);
TCCR1B = (1 << WGM13) | (1 << WGM12) | (0 << CS11);
TCNT1 = 20000;
ICR1 = 20000;
OCR1A = 10000;
OCR1B = 10000;
TIMSK1 |= (1<<OCIE1A);
TIMSK1 |= (1<<OCIE1B);
}