Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC Interrupts

Status
Not open for further replies.

alifred

Member
Hi,

I was just writing some PIC code and was experimenting with interrupts.
I was wondering, if the main PIC program is waiting (say for a second), in that second will the PIC still carry out the interrupt sub-routine?

If you do not understand what I am saying please ask!

Thanks in advance!

Fred
 
Hi,

I was just writing some PIC code and was experimenting with interrupts.
I was wondering, if the main PIC program is waiting (say for a second), in that second will the PIC still carry out the interrupt sub-routine?

If you do not understand what I am saying please ask!

Thanks in advance!

Fred

hi Fred,:)
If the Interrupts are enabled and an enabled interrupt occurs, the program will jump directly to the ISR intr service routine.

Is this what you mean.?
 
Hi,

Thanks for that!

So if the main program is waiting it will still call the interrupt and then go back to where the delay was at. So say if it was half way through a 6 second delay, it would then call the interrupt, the carry on for the rest of the delay?

Thanks

Fred
 
Hi,

Thanks for that!

So if the main program is waiting it will still call the interrupt and then go back to where the delay was at. So say if it was half way through a 6 second delay, it would then call the interrupt, the carry on for the rest of the delay?

Thanks

Fred

hi,
Thats the way it works.
Its a good idea to keep the work time as short as possible within an ISR.
Set flags as required within the ISR and service them in the main program.
 
So if the main program is waiting it will still call the interrupt and then go back to where the delay was at.

The main program doesn't really call it, it's called by something in hardware - a timer, a communications port, end of A/D conversion, that kind of thing.
 
the delay will normally be a bit longer that it should be due to the isr whcih is not accounted for ( unless it is based on a timer.... not the usual case )
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top