I am using these ISRs in a different program I am writing. TIMER5_COMPA is firing correctly and entering the ISR. However, B and C will not. BTW this is not actually being used to toggle pins. That is just what I am using to debug the ISRs. COMPA is running some code that I need to run at 400Hz and is working great. I am already using timer 1,3, and 4 for PWM generation.
#define D22Output() DDRA |= 1<<0
#define D22High() PORTA |= 1<<0
#define D22Low() PORTA &= ~(1<<0)
#define D22Toggle() PORTA ^= (1<<0);
#define D23Output() DDRA |= 1<<1
#define D23High() PORTA |= 1<<1
#define D23Low() PORTA &= ~(1<<1)
#define D23Toggle() PORTA ^= (1<<1);
#define D24Output() DDRA |= 1<<2
#define D24High() PORTA |= 1<<2
#define D24Low() PORTA &= ~(1<<2)
#define D24Toggle() PORTA ^= (1<<2);
void setup(){
D22Output();
D23Output();
D24Output();
Timer5Setup();
}
void loop(){
}
ISR(TIMER5_COMPA_vect){
D22Toggle();
}
ISR(TIMER5_COMPB_vect){
D23Toggle();
}
ISR(TIMER5_COMPC_vect){
D24Toggle();
}
void Timer5Setup(){
TCCR5A = (1<<COM5A1);
TCCR5B = (1<<CS51)|(1<<WGM52);
TIMSK5 = (1<<OCIE5A)|(1<<OCIE5B)|(1<<OCIE5C);
OCR5A = 5000;
OCR5B = 50000;
OCR5C = 50000;
}
I have tried doing this to see if I can at least get TIMER5_COMPB to fire and it does not work:
#define D23Output() DDRA |= 1<<1
#define D23High() PORTA |= 1<<1
#define D23Low() PORTA &= ~(1<<1)
#define D23Toggle() PORTA ^= (1<<1);
void setup(){
D23Output();
Timer5Setup();
}
void loop(){
}
ISR(TIMER5_COMPB_vect){
D23Toggle();
}
void Timer5Setup(){
TCCR5A = (1<<COM5A1);
TCCR5B = (1<<CS51)|(1<<WGM52);
TIMSK5 = (1<<OCIE5B);
OCR5B = 50000;
}
Hopefully someone can shed some light on why my ISRs are working correctly. Thanks in advance.