Go Down

Topic: Need help with interrupt (Read 2219 times) previous topic - next topic


Sep 24, 2009, 10:03 am Last Edit: Sep 24, 2009, 10:05 am by syrax Reason: 1
I can't handle ISR(TIMER0_OVF_vect) routine, can some help me with interrupt vectors

This is the message :
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build46918.tmp\core.a(wiring.c.o): In function `__vector_9':

C:\Program Files\arduino-0016-win\arduino-0016\hardware\cores\arduino/wiring.c:45: multiple definition of `__vector_9'
I look in datasheet and see this vector 9 is for timer1 !!! Why?

Thanks and regards from Bulgaria


Here is my test code

#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#define F_CPU 16000000UL

int counter;

 PORTB ^= (1 << 0);

void setup(){
 DDRB |= 0xff; //PORT B OUTPUT
 TCCR0 |= 0x02; //Internal clock w 8 prescaller
 TIMSK |= 0x01; //enable overflow interrupt
 TCCR0 |= 0x02; //Internal clock w 8 prescaller  

void loop(){
 PORTB ^= (1 << 5);


Timer0 is used by arduino for the millis and delay functions so is best left alone.
There are library routines in the playground that give you access to timer interrupt functionality without having to understand the low level registers. See FrequencyTimer2 for one example.

Perhaps you might say what it is you want to do?


Sep 27, 2009, 11:15 am Last Edit: Sep 27, 2009, 11:17 am by syrax Reason: 1
I solve the problem with AVR studio :)) I think is better to use if you know how becouse the arduino code is BIGGER and little slow. My program is about 5K in pure C++ and have to write more code to finish my program . When i use direct access to register from arduino  this make program smaller.

And last question is possible to remove from arduino millis and free this timer, asking becouse this is primitive time0 and is great from refreshing if you have display, buttons ... The idea is to run it on background and dont tnink it more in main code

Is the delay() use timer0 ????  :o   I use util/delay.h with no timers
Regards from Bulgaria


Yes, delay uses millis which uses timer 0

This is not intended top be impolite but if you are not using the Arduino IDE or any arduino functions, your questions may me more suited for the avrfreaks forum.

Go Up