Searching \ for '[PIC:] IF flags' 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/devices.htm?key=pic
Search entire site for: 'IF flags'.

Exact match. Not showing close matches.
PICList Thread
'[PIC:] IF flags'
2005\02\27@135456 by Roland

flavicon
face
Hi All

Something I'm not sure about;

Lets say I'm using Timer1, and interrupts;

so I'll be clearing TMR1IF in the int routine

is it prudent to clear all other flags in the PIR1 register that are not
being used, before exiting, 'just in case'?

Obviously the IE for those functions were setup to zero, but could a glitch
cause a re-interrupt loop?

So the answers?? are;
- always clear every other unused IF before exiting the interrupt routine, or
- if the IE for that funtion was cleared on power-up, no bother with it's IF

TIA


Regards
Roland Jollivet

2005\02\27@135715 by Roland

flavicon
face
Hi All

Something I'm not sure about;

Lets say I'm using Timer1, and interrupts;

so I'll be clearing TMR1IF in the int routine

is it prudent to clear all other flags in the PIR1 register that are not
being used, before exiting, 'just in case'?

Obviously the IE for those functions were setup to zero, but could a glitch
cause a re-interrupt loop?

So the answers?? are;
- always clear every other unused IF before exiting the interrupt routine, or
- if the IE for that funtion was cleared on power-up, no bother with it's IF

TIA


Regards
Roland Jollivet

2005\02\27@143413 by Jan-Erik Soderholm

face picon face
Roland wrote :

> is it prudent to clear all other flags in the PIR1 register
> that are not being used, before exiting, 'just in case'?
>
> Obviously the IE for those functions were setup to zero, but
> could a glitch cause a re-interrupt loop?

Only if that glitch would set ("un-clear") the IE flag...

I have never seen any recomendation to re-clear
every IF flag on each interrupt "just in case".

It would help to know why you ask. Have you seen
any problem where it looks like this could be the cause ?

Regards,
Jan-Erik.



2005\02\27@145644 by Wouter van Ooijen

face picon face
> - if the IE for that funtion was cleared on power-up, no
> bother with it's IF

Ask yourself: do you want your product to be resistent to just one
particular bit flip (maybe because to can reason that it has a much more
desatreous result than all other bit flips), or do you plan to make it
resistent to all possible bit flips?

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu


2005\02\27@151149 by Roland

flavicon
face
At 08:34 PM 27/02/2005 +0100, you wrote:
>Roland wrote :
>
>> is it prudent to clear all other flags in the PIR1 register
>> that are not being used, before exiting, 'just in case'?
>>
>> Obviously the IE for those functions were setup to zero, but
>> could a glitch cause a re-interrupt loop?
>
>Only if that glitch would set ("un-clear") the IE flag...
>
>I have never seen any recomendation to re-clear
>every IF flag on each interrupt "just in case".
>
>It would help to know why you ask. Have you seen
>any problem where it looks like this could be the cause ?
>
>Regards,
>Jan-Erik.
>

I only ask to find out if it's good programming practise, part of the
'assume nothing' philosophy.
Because, if it did happen out in the field, and cause the product to hang,
it'd be hard to ascertain that as a cause.

Basically, something I made is hanging about once a week(automotive), and
I'm wondering about all the possibilities.
But, if it were (long shot) the problem, my external wdt will cause a
reset, and all the IE's are 0 on POR, so, looking elsewhere.....

Regards
Roland Jollivet

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