Hi, nice people. My problem is the interrupt service routine (ISR), which apparently never runs! Here is some information about my setup: I sparkle avr attiny85. I have the bare bones of a project created so far with a simple main.c and two modules: timer and hardwareInit. In the timer module, I have a timer0_init function that I use to set timer0 for CTC mode to overflow for just 1 ms. Here is the function:
void timer0_init( void )
{
cli();
TCCR0B |= 3;
TCCR0A |= 2;
OCR0A = 0x7C;
TIMSK |= 2;
sei();
}
with a timer setting, I added an ISR to increase ticks every time the counter overflows, so I can track how much time has passed, etc.
ISR(TIMER0_OVF_vect)
{
cli();
PORTB |= ( 1 << PORTB0 );
sei();
}
, ticks ++, , PORTB |= ( 1 << PORTB0 );, , , , .
, , . ( , , , 2. , PORTB |= ( 1 << PORTB0 ); , )
, main.c:
#define F_CPU 8000000UL
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "timer.h"
#include "hardwareInit.h"
int main(){
DDRB |= ( 1 << PORTB0 );
SetClockPrescale(1);
timer0_init();
while(1)
{
}
return 0;
}
, , , , , , - , ( ) , .
, , . , .