Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] problem in AVRStudio timer interrupt subroutine

Status
Not open for further replies.

MISU.RSG

Member level 1
Joined
Apr 29, 2011
Messages
34
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,581
hi dear

I faced with a problem when I work with timers interrupt sub routine.
I used avrstudio 6.2. I wrote this code.
Code:
// ***************************** Timer 2 compare Subroutine *********************************
//							Start of function
void ISR (int TIMER2_COMP_vect){
	rsig_on;
	OCR2=pulse_value++;
	
	if (pulse_value==256)
	{	pulse_value=190;
	}
reti();
}
//							End of Timer 0 compare Subroutine

// ***************************** Timer 2 overflow Subroutine *********************************
//							Start of function
void ISR( TIMER2_OVF_vect){
	TCNT2=190;
	rsig_off;
	lsig_off;
}
//                          End of overflow Subroutine

after compiling I saw this error:
Error 2 redefinition of 'ISR'
what's my fault?
 

Hi,

i don´t know much about C programming...

but in other examples there is no "void" before the "ISR". Could this cause the error?

Klaus
 

yep also
void ISR (int TIMER2_COMP_vect){
there's no need for that 'int' you just need to declare ISR(TIMER2_COMP_vect){ ... }

also, don't use reti(); it's only used when declaring a _NAKED_ interrupt routine, as yours aren't those, the compiler will add the correct instruction to return from the interrupt while restoring the rest of registers from stack...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top