Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Where to disable the GIE bit on a PIC interrupt?

Status
Not open for further replies.

blueroomelectronics

Well-Known Member
Where in an Interrupt should you disable the GIE bit?
(or do you have to?)
Code:
         org      0x004             ;IRQ routines
Push     bcf      INTCON, GIE       ;Bx
         movwf    W_Stack             ;Bx given multiple banks, and no global memory 
         swapf    STATUS,W     ;Bx The swapf instruction, unlike the movf, affects NO status bits, which is why it is used here.
         clrf     STATUS             ;Bx point to bank 0 and clear all the flags
 
I don't use assembly very much, but I was under the impression it gets cleared automatically, otherwise it would get stuck in an infinite loop if you didn't immediately clear it.

looking at the datasheet for the 16F88 for example, it does say on the first page about interrupts that the GIE bit gets cleared, and that the instruction RETFIE automatically sets it again when exiting the ISR.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top