Searching \ for '[PIC]: Interupt problems HELP!' 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: 'Interupt problems HELP!'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Interupt problems HELP!'
2001\02\07@113500 by info

flavicon
face
Hi gang

Having a little Interrupt problems with the f877. 2 days and counting ):
I am using an ice2000 now to try and debug the problem with no joy.

Basically the GIE bit keeps turning itself off randomly and locking the
code. here is a simplified version of the code. Nops replace the main
program parts to simplify.
-------------------------------
interupt routine
       save context                    ;obvious
       btfsc   PIR1,TMR1IF             ;tmr1 int
       goto    timer1overflow

       other interupt stuff
       restore context
       retfie
timer1overflow
       bsf     overflowflag            ;set tmr1 interupt flag
       restore context
       retfie
-------------------------------
START
       set ports and normal stuff
       set up interupts
       BSF INTCON,GIE

MAIN    bcf     INTCON,GIE              ;turn ints off
       nop
       check for external signal w     ;part of my code
       nop
       bsf     INTCON,GIE              ;turn ints on
       nop
       call loop                       ;call sub
       goto    MAIN                    ;go again

loop    nop
       nop
       btfss   timer1overflowflag      ;has tmr1 int
       goto    loop                    ;repeat loop
       bcf     timer1overflowflag      ;clr flag
       return                          ;end sub
-----------------------------------
The program gets stuck in the loop when the GIE bit seems to randomly
clear itself??????? Any ideas

Scott

ccessories )
website:            http://www.broadcastwarehouse.com
email:              spam_OUTinfoTakeThisOuTspambroadcastwarehouse.com

phone:
  sales:
       inland (uk) 0208 5409992
       international +44 208 5409992
  tech support:
       inland (uk) 0208 5409993
       international +44 208 5409993
fax     inland (uk) 0208 5409994
       international +44 208 5409994
*******************************************************

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\02\08@023322 by Vasile Surducan

flavicon
face
From my experience you must turn the intcon_gie off at the begining of the
interrupt and not in the main. Else multiple interrupts may occure.
Also you don't need to set intcon_gie on in the main because retfie do
this job when you go out from ISR
Vasile

On Wed, 7 Feb 2001, info wrote:

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\08@075243 by Michael Rigby-Jones

flavicon
face
> -----Original Message-----
> From: Vasile Surducan [SMTP:vasilespamKILLspamL30.ITIM-CJ.RO]
> Sent: Thursday, February 08, 2001 7:10 AM
> To:   .....PICLISTKILLspamspam.....MITVMA.MIT.EDU
> Subject:      Re: [PIC]: Interupt problems HELP!
>
> From my experience you must turn the intcon_gie off at the begining of the
> interrupt and not in the main. Else multiple interrupts may occure.
> Also you don't need to set intcon_gie on in the main because retfie do
> this job when you go out from ISR
> Vasile
>
GIE is automatically cleared when the PIC jumps into an ISR.

Mike

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\08@090935 by Drew Vassallo

picon face
> > -------------------------------
> > START
> >         set ports and normal stuff
> >         set up interupts
> >         BSF INTCON,GIE
> >
> > MAIN    bcf     INTCON,GIE              ;turn ints off

This is not a good way to disable interrupts.  Recall from the datasheet
(any datasheet) that the bit may get set during this operation from the
interrupt, preventing it from being cleared.  This may not be your problem,
but it never hurts to be correct.

Try:

MAIN  bcf INTCON, GIE      ; clear bit
     btfsc INTCON, GIE    ; is bit clear?
     goto MAIN            ; if not, try again

> >         nop
> >         check for external signal w     ;part of my code
> >         nop
> >         bsf     INTCON,GIE              ;turn ints on
> >         nop
> >         call loop                       ;call sub
> >         goto    MAIN                    ;go again

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\08@092024 by info

flavicon
face
In message <EraseME0F60BEDDC090D41185D300508BCFA39EE81431spam_OUTspamTakeThisOuTzpgty002.europe.norte> l.com>, Michael Rigby-Jones <mrjonesspamspam_OUTNORTELNETWORKS.COM> writes
>> {Original Message removed}

2001\02\08@094526 by Olin Lathrop

face picon face
> From my experience you must turn the intcon_gie off at the begining of the
> interrupt and not in the main. Else multiple interrupts may occure.

No.  GIE is cleared as part of the interrupt.  You do have to clear the
interrupt condition (the xxxF bit) else you will get a new interrupt as soon
as interrupts are re-enabled by RETFIE.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, @spam@olinKILLspamspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\08@110822 by Olin Lathrop

face picon face
> This is not a good way to disable interrupts.  Recall from the datasheet
> (any datasheet) that the bit may get set during this operation from the
> interrupt, preventing it from being cleared.

Not any datasheet.  For example, this problem is mentioned in the 16C7x
datasheet, but not the 16F87x data sheet because these chips don't have this
problem.

Does anyone have a definative list of which chips have this problem and
which don't?  I'd rather not look thru all the data sheets to find out.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, KILLspamolinKILLspamspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\08@135739 by Bob Ammerman

picon face
> Not any datasheet.  For example, this problem is mentioned in the 16C7x
> datasheet, but not the 16F87x data sheet because these chips don't have
this
> problem.
>
> Does anyone have a definative list of which chips have this problem and
> which don't?  I'd rather not look thru all the data sheets to find out.

> Olin Lathrop, embedded systems consultant in Devens Massachusetts
> (978) 772-3129, RemoveMEolinTakeThisOuTspamembedinc.com, http://www.embedinc.com
>

Olin,

Would you trust a list based on what the datasheets say?

I'm pretty certain the 87x series do not have this problem, but I'd be
happier if somewhere I could find an mChip document that spelled out which
chips are which.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\08@153855 by Olin Lathrop

face picon face
> Would you trust a list based on what the datasheets say?

Hmm, good point.

> I'm pretty certain the 87x series do not have this problem, but I'd be
> happier if somewhere I could find an mChip document that spelled out which
> chips are which.

I would like to know.  If I had the list I would update my INTR_OFF macro to
take the processor into account and generate the appropriate code.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, spamBeGoneolinspamBeGonespamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\09@035655 by Vasile Surducan

flavicon
face
Interesting ! Now I'm really confused. However an interrupt routine like
this work's very well:

isr routine:
       ;save all
loop:     bcf    intcon_gie    -- disable all interrupts
          btfsc  intcon_gie    -- be sure
          goto   loop
       ;isr body

       ;recall all
          retfie

main program
          bsf intcon_gie
          bsf intcon_t0ie
          bsf intcon_rbie
       ;main body
end

In ISR body I've test if interrupt on change occures, if yes, I clear
intcon_rbie and do my job. Before outputting from ISR I've set
active interrupts on tmr0 and tmr1 so if there is no interrupt on change
may be an interrupt on tmr0 or tmr1.
So, if this is working and GIE is automaticaly cleared jumping to ISR
( not only after a retfie ) the whole loop needed for disable global
interrupts is a redundant code.
Vasile



Michael said: GIE is automatically cleared when the PIC jumps into an ISR.


On Thu, 8 Feb 2001, Olin Lathrop wrote:

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\02\09@084958 by Olin Lathrop

face picon face
> Interesting ! Now I'm really confused. However an interrupt routine like
> this work's very well:
>
> isr routine:
>         ;save all
>  loop:     bcf    intcon_gie    -- disable all interrupts
>            btfsc  intcon_gie    -- be sure
>            goto   loop

Yes, this "works", but that's because it does nothing.  GIE is already off
when get into the interrupt routine, so explicitly setting it off is just a
waste of cycles.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, olinEraseMEspam.....embedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspammitvma.mit.edu with SET PICList DIGEST in the body


2001\02\12@022944 by Vasile Surducan

flavicon
face
You've right !
Vasile


On Fri, 9 Feb 2001, Olin Lathrop wrote:

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\02\12@071933 by Wollenberg, Frank

flavicon
face
> -----Original Message-----
> From: info [RemoveMEinfoTakeThisOuTspamspamBROADCAST-WAREHOUSE.COM]
> Sent: Wednesday, February 07, 2001 5:34 PM
>
> -------------------------------
> interupt routine
>         save context                    ;obvious
>         btfsc   PIR1,TMR1IF             ;tmr1 int
>         goto    timer1overflow
>
>         other interupt stuff
>         restore context
>         retfie
> timer1overflow
>         bsf     overflowflag            ;set tmr1 interupt flag
         bcf     PIR1,TMR1IF             ;clear tmr1 int !!!
>         restore context
>         retfie
> -------------------------------

Hi Scott,
you must clear the int flag at the end of your isr() as shown above.
As others have written, GIE is cleared on entry into isr(), disabling
further interrupts.
So there's no need to clear GIE.
BTW there is a problem clearing GIE in some PICs. Use Drew's solution, also
described in the data sheets.
> MAIN  bcf INTCON, GIE      ; clear bit
>       btfsc INTCON, GIE    ; is bit clear?
>       goto MAIN            ; if not, try again

Hope this helps,
Frank

GSP Sprachtechnologie GmbH
Frank Wollenberg
HW-Entwicklung
Tel.:   +49 (0)30 769929-78
Fax:    +49 (0)30 769929-12
eMail:  EraseMEf.wollenbergspamspamspamBeGonegsp-berlin.de




--
GSP Sprachtechnologie GmbH
Teltowkanalstr.1, D-12247 Berlin
Tel.:  +49 (0)30 769929-0
Fax:   +49 (0)30 769929-12
eMail: RemoveMEInfoKILLspamspamgsp-berlin.de
Web:   http://www.gsp-berlin.de

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\02\12@072345 by info

flavicon
face
In message <01E61235877ED411A0A40001029D6ADA056B66@RFC1918-Host>,
Wollenberg, Frank <F.WollenbergSTOPspamspamspam_OUTGSP-BERLIN.DE> writes
>> {Original Message removed}

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