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.

problem with interrupt

Status
Not open for further replies.

sefat

Newbie level 4
Joined
Nov 17, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
i want interrupt every 20ms.this code is not invoking the isr. where is the problem ? plz help.
{
TCNT1=-625;
TCCR1A=0x00;
TCCR1B=0x04;
TIMSK|=(1<<TOIE1);
sei();

}

ISR (TIMER1_OVF_vect)
{
//code}
 

Which mcu are you using and posy the full code using code tags.
 

Why do you pass a negative value to TCNT1?

You are using a timer frequency of 1/256 of the core but what is the frequency of the core?
 

i want interrupt every 20ms.this code is not invoking the isr. where is the problem ? plz help.
You didn't mention which MCU you are using. Obviously it's an AVR, but which one?
This code compiles and the ISR is not triggered? Because "TIMSK" seems that should be accessed as "TIMSK1", even though we still don't know which MCU is used.
 

i'm using atmega 32 with an external crystal of 8MHz.

the meaning of negative value is:
TCNT1H=0xFD;
TCNT1L=0x8F;
 

And why put a negative values instead of TCNT1=0xFD8F ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top