Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 23rd May 2004, 04:20 PM   (permalink)
Default Interrupt on PIC

Hello!

I'm going to start a new project with a pic16f84 and one of my quetions is how the interrupt on RA4 works. When does a interrupt happend?? is it only from low-to-high or/and reversed?? What happends in the MCU on a intterupt?? Does it just set a memmory or will it stop my program??

Thanks!
radialspel is offline  
Reply With Quote
Old 23rd May 2004, 04:37 PM   (permalink)
Default

First of all, it's pin RB0 that has the interrupt feature, not RA4.

It can be set to respond to a high to low and to a low to high in software.
If an interrupt occurs then your pic will stop whatever it is doing and handle an interrupt routine immediately, when the interrupt routine is done it will continue were it left off...
Exo is offline  
Reply With Quote
Old 26th May 2004, 08:16 AM   (permalink)
Default interrupts

.. waht happends if to much interrupts occur??

and how can we calculate that ammout..??

TKS
TKS is offline  
Reply With Quote
Old 26th May 2004, 08:23 AM   (permalink)
Default Re: interrupts

Quote:
Originally Posted by TKS
.. waht happends if to much interrupts occur??

and how can we calculate that ammout..??

TKS
Too many shouldn't be able to occur, and you should design your code accordingly - when an interrupt is called the interrupt enable is turned off, you should reenable it when you exit your interrupt routine.

This applies to any system really, but it's particularly important on a PIC where you have a very small stack. If the stack overflows (on any system) it's likely to be a total disaster :lol:
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply With Quote
Old 26th May 2004, 08:40 AM   (permalink)
Default

There are no nested interrupts, except that a high priority interrupt can interrupt a low.

Repeated interrupts of the same type will only set the interrupt flag for that type. If the flag hasn't been cleared, it's lost.

Ex: You have the interrupt enabled on low-to-high transition of an RB0 pin. Button is pressed, RB0 interrupt flag is set, which causes the code to hault and enter the ISR. Your ISR checks all the flags and finds RB0 flag is set. This has taken a number of clock cycles, and the button has bounced which keeps causing the RB0 interrupt. Well, it's only reasserting the fact that the flag is 1. Your ISR code will eventually assign 0 to the flag and return to the main code.
Oznog is offline  
Reply With Quote
Old 26th May 2004, 10:24 AM   (permalink)
Default

Quote:
Originally Posted by Oznog
There are no nested interrupts, except that a high priority interrupt can interrupt a low.
Only on 18F pic's, 16F's don't have priority interrupts.
Exo is offline  
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 06:00 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.