Searching \ for '[PIC]High or Low priority interrupt?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: 'High or Low priority interrupt?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]High or Low priority interrupt?'
2005\04\25@011611 by Hopkins

flavicon
face

In the 18F series there are High & Low priority interrupts.

This may seem a bit silly :-) but when should you use each type of
interrupt?
_______________________________________
Roy
Tauranga
New Zealand
_______________________________________


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.2 - Release Date: 21/04/2005


2005\04\25@033239 by Jose Da Silva

flavicon
face
On April 24, 2005 10:15 pm, Hopkins wrote:
> In the 18F series there are High & Low priority interrupts.
>
> This may seem a bit silly :-) but when should you use each type of
> interrupt?

You would use a low priority on a slow device, for example, a keyboard
interrupt. The keyboard can wait another couple milliseconds while you
service something which needs immediate attention.

You would use a high priority on something which needs to be done right
away, for example, you just lost all your AC power and now you got 3
seconds worth of power before your circuit is dead.
This would be a good time to forget about servicing that slow keyboard,
and immediately backup all your RAM to the harddrive or non-voltile
memory.

Perhaps your circuit has neither a keyboard or a harddrive.
Perhaps it is GPS tracking (low priority so you know how lost you are
while driving) and an accident about to happen (distance meter tracking
car ahead of you before deploying your airbags).

2005\04\25@084251 by Gerhard Fiedler

picon face
Jose Da Silva wrote:

> On April 24, 2005 10:15 pm, Hopkins wrote:
>> In the 18F series there are High & Low priority interrupts.
>>
>> This may seem a bit silly :-) but when should you use each type of
>> interrupt?

> You would use a low priority on a slow device, for example, a keyboard
> interrupt. The keyboard can wait another couple milliseconds while you
> service something which needs immediate attention.

In addition to the emergency type examples Jose cited, I'd add anything
where low jitter is important. Using the keyboard interrupt as an example,
you can safely ignore a few ms jitter on such an interrupt. But you can't
ignore a few ms jitter on an async rx/tx interrupt that implements firmware
communication, or when sampling data for a FFT or some such.

Whether you actually need the two levels depends a lot on your overall
application design. If your application has a quick main loop, your
interrupts don't do much besides caching byte data and flipping bits and
most of the work is done in the main loop, you probably won't need the two
levels. The lower level is mainly meant for interrupt-driven actions that
may take a while and therefore may have to be interrupted by the "real"
interrupts (which would be the high-priority interrupts).

You can think of the lower level interrupts as an additional application
level between the main loop (which they can interrupt) and what you put
into interrupts (which would be the high-priority interrupts). Or you can
think of the low-priority interrupts as your normal interrupt level, and
put a select few of those interrupts (the extremely time-critical, maybe
the ones where you had jitter problems so far) into the high-priority
level.

Whether this brings real advantage depends a lot on the application.
Probably low-power applications (with generally low clock speeds relative
to the requirements) are among those that can make good use of this
feature.

Gerhard

2005\04\25@103117 by Herbert Graf

flavicon
face
On Mon, 2005-04-25 at 17:15 +1200, Hopkins wrote:
> In the 18F series there are High & Low priority interrupts.
>
> This may seem a bit silly :-) but when should you use each type of
> interrupt?

I generally think of it this way: high priority interrupts should be
used for things that need to be done as quickly and predictably as
possible. RS232 rx/tx through software would be a good example, as would
PWM.

Low priority interrupts are usually for things that COULD be done with
simple software polling, but are done with an interrupt for ease of
coding. Anything "slow" is usually a good candidate for low priority
interrupts, things such as blinking an LED, reading a keyboard, etc.

Notice none of this is set in stone, there are cases where blinking an
LED might require a high priority interrupt, who knows! :) TTYL

-----------------------------
Herbert's PIC Stuff:
http://repatch.dyndns.org:8383/pic_stuff/

2005\04\25@112636 by Andre Abelian

picon face

Herbert,

just opposite.

Andre Abelian  





-----Original Message-----
From: spam_OUTpiclist-bouncesTakeThisOuTspammit.edu [.....piclist-bouncesKILLspamspam@spam@mit.edu] On Behalf
Of Herbert Graf
Sent: Monday, April 25, 2005 7:31 AM
To: Microcontroller discussion list - Public.
Subject: Re: [PIC]High or Low priority interrupt?

On Mon, 2005-04-25 at 17:15 +1200, Hopkins wrote:
> In the 18F series there are High & Low priority interrupts.
>
> This may seem a bit silly :-) but when should you use each type of
> interrupt?

I generally think of it this way: high priority interrupts should be
used for things that need to be done as quickly and predictably as
possible. RS232 rx/tx through software would be a good example, as would
PWM.

Low priority interrupts are usually for things that COULD be done with
simple software polling, but are done with an interrupt for ease of
coding. Anything "slow" is usually a good candidate for low priority
interrupts, things such as blinking an LED, reading a keyboard, etc.

Notice none of this is set in stone, there are cases where blinking an
LED might require a high priority interrupt, who knows! :) TTYL

-----------------------------
Herbert's PIC Stuff:
http://repatch.dyndns.org:8383/pic_stuff/

2005\04\25@120419 by Mike Harrison

flavicon
face
On Mon, 25 Apr 2005 10:31:12 -0400, you wrote:

>On Mon, 2005-04-25 at 17:15 +1200, Hopkins wrote:
>> In the 18F series there are High & Low priority interrupts.
>>
>> This may seem a bit silly :-) but when should you use each type of
>> interrupt?

You need to fully understand the timing constraints of your system, in particular whet is the worst
interrupt response time that can be tolerated. e.g. a serial receive int needs to be serviced within
one byte time to guarantee no data loss.
High-priority ints will always be serviced in a predictable time. Low-priority ints may get delayed
if a high-priority one is being serviced at the same time.

You only really need to worry about int priority if there is an interrupty that cannot tolerate
either the delay, or delay unpredictability of the slowest other interrupt service routine. A good
example would be bit-bashed RS232 serial transmit/receive code, where data would be lost if timing
jitter exceeds about 5% - a high-priority int would be needed for all but the slowest baudrates if
there are any other interrupts possible.

A second good reason to use high-priority ints is that the context-save for high-priority ints is
much faster, so would be appropriate for very frequently occurring ints to reduce overall CPU
loading.

Generally, a reasonable approach is to use low-priority ints unless there is a very good reason to
do otherwise, and then only have one high-priority one.



2005\04\25@135827 by piclist

flavicon
face
On Mon, 25 Apr 2005, Mike Harrison wrote:

> High-priority ints will always be serviced in a predictable time. Low-priority ints may get delayed
> if a high-priority one is being serviced at the same time.

Just as high priority interrupts may get delayed if another high
priority interrupt is being serviced.  Using interrupt priorities is
generally more useful if you have exactly one high priority interrupt
source.

> Generally, a reasonable approach is to use low-priority ints unless there is a very good reason to
> do otherwise, and then only have one high-priority one.

I would say generally, don't use interrupt priorities at all unless
you have a specific reaason to do so.  Making all interrupts high
priority will use less code space, and will work fine for most
applications.

--
John W. Temples, III

2005\04\25@150304 by Hopkins

flavicon
face
Thanks guys for the replies.

STOP THE PRESS :-)

_______________________________________
Roy
Tauranga
New Zealand
_______________________________________



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.3 - Release Date: 25/04/2005


More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...