EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

[PIC]: 12F675 interrupt on change, a lost sunday...

Started by Vasile Surducan August 11, 2003

Hi groups !

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

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 ?

thank you in advance,
Vasile
http://surducan.netfirms.com



What exactly is it doing or not doing? The mismatch condition is
cleared by reading, not writing.

Chad

--- Vasile Surducan <> wrote:
>
> Hi groups !
>
> 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
>
> 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 ?
>
> thank you in advance,
> Vasile
> http://surducan.netfirms.com
__________________________________






By reading, sure, it was a writting mistake. Moving the port value into
w register. I can't sense the change in any pin input. The pullpup is
enabled by option so pulling low the input must be seen as a change state.
However, does not. On Mon, 11 Aug 2003, Chad Russel wrote:

> What exactly is it doing or not doing? The mismatch condition is
> cleared by reading, not writing.
>
> Chad
>
> --- Vasile Surducan <> wrote:
> >
> > Hi groups !
> >
> > 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
> >
> > 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 ?
> >
> > thank you in advance,
> > Vasile
> > http://surducan.netfirms.com >
> __________________________________ > to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
>
> ">http://docs.yahoo.com/info/terms/





With out seen the code and schematic, I can only guess. Make sure you
do a port read immediately before enabling the "Interrupt on Change"
flag for the first time. Changing any of these pins from an input to
an output can cause an interrupt. Is the pin actually being pulled up
and down. The weak pullup is only 400 microamps max.

Chad

--- Vasile Surducan <> wrote:
>
>
> By reading, sure, it was a writting mistake. Moving the port value
> into
> w register. I can't sense the change in any pin input. The pullpup is
> enabled by option so pulling low the input must be seen as a change
> state.
> However, does not. > On Mon, 11 Aug 2003, Chad Russel wrote:
>
> > What exactly is it doing or not doing? The mismatch condition is
> > cleared by reading, not writing.
> >
> > Chad
> >
> > --- Vasile Surducan <> wrote:
> > >
> > > Hi groups !
> > >
> > > 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
> > >
> > > 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 ?
> > >
> > > thank you in advance,
> > > Vasile
> > > http://surducan.netfirms.com
> >
> >
> >
> > __________________________________
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> >
> > ">http://docs.yahoo.com/info/terms/
> >
>


__________________________________




The 2024 Embedded Online Conference