|
| |
Jallist Archive Aug 2003
Re: [PIC]: 12F675 interrupt on change, a lost sunday...
From: Eur van Andel <eur(at)fiwihex.nl>
Date: 11 Aug 2003 13:07:11 +0200
On Mon, 11 Aug 2003 11:17:18 +0300 (EEST), Vasile Surducan
wrote:
>I have spend a whole sunday trying to understand why interrupt of change
>are not working for me. I have played with those on PIC16F877 and works
>ok there.
>According to DS41190A datasheet, using interrupt of change means:
>In the main program:
>- enabling all interrupts by setting gie
>- enabling interrupts on change by setting gpie
>- enabling pins individual interrupts on change by setting iocb0-iocb5
OK.
>In the interrupt routine:
>- push-ing the status and w
>- detecting gpif high state
>- disabling gie
>- writting the specific gpio to itself for mistmach condition
>- calling the user isr routine
>- clearing the gpif for the next interrupt sequence
>- pop-ing the status_saved and w_saved
>- retfie-ing ( gie is enabled)
>
>However, does not work. There is something I'm missing as new
>(and unknown for me) 12F675 erata ?
Explain: "does not work":
Is the GPIF flag set?
Does your program enter the interrupt routine at all?
Javi is right:
> Interrupts are always disabled in interrupt (at least in pic14).
>This is not necesary (BCF GIE),
datasheet:
>When an interrupt is serviced:
>• The GIE is cleared to disable any further interrupt
>• The return address is pushed onto the stack
>• The PC is loaded with 0004h
page 63/61 datasheet
http://www.microchip.com/download/lit/pline/picmicro/families/12f6xx/41190c..pdf
Javi again:
>and I have a question: clearing gie
>inside interrupt, will be set on exit (REFIE)?
Answer:, if the xxIF is still up, it will be set again, AFAIK.
Wouter?
The datasheet says:
>Once in the Interrupt Service Routine, the source(s) of
>the interrupt can be determined by polling the interrupt
>flag bits. The interrupt flag bit(s) must be cleared in
>software before re-enabling interrupts to avoid GP2/
>INT recursive interrupts.
|
|
|