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.

How to use both timer and external interrupt?

Status
Not open for further replies.

john2020

Full Member level 5
Full Member level 5
Joined
Nov 13, 2005
Messages
292
Helped
12
Reputation
24
Reaction score
8
Trophy points
1,298
Activity points
4,911
hi all,

I have a timer interrupt problem. When i use timer 1 & external interrupt together, i disable All interrupt and enable it again when leaving the function. If there is external interrupt, it may miss the the timer intrrupt. Am i true???

So, if I want to allow both interrupt to happen even in any ISR, what should I set?
Should I enable all interrupt even in the ISR to allow this?

reply me as soon as possible.
 

TImer Interrupt

hello john2020,

Are you using a PIC MPU?

If you are the following must be done: I assumed that both External RBO interrupt and Timer Overflow Interrupt are both Enabled.

a.) during an interrupt you check first the INTCON, TOIF if it is SET to see if the interrupt is timer overflow, otherwise the interrupt must have been caused by external trigger on RB0 pin.

b.) The last thing you do before exiting you Interrupt service routine and enabling again all interrupts to occur, be sure to CLEAR the TOIF( Timer overflow interrupt flag) so that the next overflow will be detected, otherwise if TOIF is still SET, it won't cause an interrupt. Be sure also to CLEAR also the RB0 Interrupt flag after processing the interrupt.

All interrupt flag bits can be found at the INTCON register.

hope this help
 
Re: TImer Interrupt

Which microcontroller family are you talking about?
Regards,
IanP
 
Re: TImer Interrupt

hi neoaspilet11.

i am using PIC MCU.thanks for your information
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top