Hi I have been trying to get a timer to fire a compare ISR on the Olimexino85
Similar code works on the UNO etc, but I cant seem to get it to run, I dont think the ISR is being accessed
Here is the code
/*
* OLIMEXINO tiny85_blink_by_timer_interrupt.ino
*/
#include <avr/io.h>
#include <avr/interrupt.h>
void setup()
{
// Disable global interrupts before initialization
cli();
//initialize the PortB Pin1 to output;
DDRB |= (1<<PINB1);
//initialize the timer0
TCCR0A = (1<<WGM01); // Put timer0 in CTC mode and clear other bits
TCCR0B = (1<<CS02) ; // Timer0 prescaling 256 and clearing other bits
TIMSK |= (1<<OCIE0A); // enable timer1 compare interrupt
//set the timer0 count
OCR0A = 255; // Count 255 cycles before calling ISR interrupt
PORTB |= (1<<PINB1); // Set PortB Pin1 high to turn on LED
//initialize global interrupts before beginning loop
sei();
}
void loop()
{
}
ISR(TIM0_COMPA_vect) {
//toggle the PortB pin1 to HIGH or LOW
PORTB ^= (1<<PINB1);
}