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.

Interrupt execution doubt

Status
Not open for further replies.

varunme

Advanced Member level 3
Joined
Aug 10, 2011
Messages
741
Helped
17
Reputation
36
Reaction score
17
Trophy points
1,318
Activity points
5,764
when one interrupt is going on , and in between if another interrupt condition occurs , then after that is completed , then the program goes to the previous interrupt ?
like , i gave a 5 minute delay for a program during that time another condition occurs like button press or something , after the procedure according to the button is completed , will the 5 minute delay stays in the program ?
 

When the mcu is able to use recursive interrupts then it stops the execution of the first interrupt and jumps to the second interrupt, when the second interrupt finishes then the execution of the first interrupt resumes exactly where it was left and when it finishes too then the main code resumes again in the exact point where it was stopped.

Alex
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
means the 5 minute delay goes on even after the second interrupt ?
 

varunme said:
means the 5 minute delay goes on even after the second interrupt ?
Yes the delay will continue after the interrupts. If you want the delay to be stopped if an interrupt occurs, then you can use some shared flags between interrupts and delay.
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
If the 5min delay is interrupted then total delay will be 5min + execution time of the second interrupt (assuming that you are using a delay based on the cpu cycles).
The delay will pause while the second interrupt in executed unless of course if it is based on a timer counter which doesn't pause during interrupts.

Alex
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
if it is based on a timer counter which doesn't pause during interrupts.
Alex

if its based on timer counter , then what happens to delay ?
 

varunme said:
if its based on timer counter , then what happens to delay ?

Alex has already gave the answer:

alexan_e said:
The delay will pause while the second interrupt in executed unless of course if it is based on a timer counter which doesn't pause during interrupts.
 
  • Like
Reactions: varunme

    varunme

    Points: 2
    Helpful Answer Positive Rating
I suppose you have used timer delay in the past.
If the counter is 16bit or 32 bit then you can achieve long delay without any need to use a counter overflow (rollover) variable , for example a 16bit counter measures up to 65535 so if you use a 32KHz clock you can achieve a delay of 2 sec easily.
If you have an 8bit counter that measures up to 255 then you have to use an interrupt on each overflow to increase a variable so that you can keep and calculate the total counts.

In either case since the timer doesn't stop when any interrupt is executed the delay period will be the specified one even if another interrupt is executed in the middle of the counted period.
Depending on the timer bits , delay period and implementation, if an overflow interrupt is used you have to be able to use recursive interrupts in order for the timer overflow interrupt to be called even when another interrupt is executed so that the delay duration is measured properly.

Alex
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top