GIEH status in interrupt routine

(instructions, reset, WDT, specifications...) PIC17Cxx, PIC18Fxxx

GIEH status in interrupt routine

Postby Keno » Wed Dec 02, 2020 5:50 pm

In order for PIC to issue an interrupt, GIEH (Global Interrupt Enable, High priority) must be enabled among other things. This seems logical, looking at interrupt logic scheme. However, should this bit be changed during interrupt function?

According to one source, GIEH is only set (GIEH = 1) in the main function and left unchanged. However, according to some other source, GIEH is also set in main function, but when interrupt function starts, it is cleared (GIEH = 0) and before this function ends, GIEH is set.

Brez naslova.png
Brez naslova.png (138.88 KiB) Viewed 1614 times


Should GIEH be altered during interrupt function (for some reason)?

Keno
Keno
 
Posts: 11
Joined: Sat Nov 07, 2020 10:15 am
PIC experience: EE Student

Re: GIEH status in interrupt routine

Postby AussieSusan » Thu Dec 03, 2020 3:06 am

The setting and clearing of the GIE bit around an ISR is done by the hardware, NOT by you in your code. I'm not sure which MCU you are referring to but I think it is the same for all of the smaller ones (e.g. PIC18 and below). Read up on the way the interrupts are processed in the data sheet and also I think it is described in the 'return from interrupt' instruction description.
Therefore you should only set the bit as part of your initialisation code and forget it after that.
Susan
AussieSusan
Verified identity
 
Posts: 173
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: GIEH status in interrupt routine

Postby ric » Mon Dec 07, 2020 6:46 am

As above. That diagram appears to be from one of the 8 bit PIC datasheets, but this has been posted in the 16 bit forum.
n.b. PIC16Fxxx device are NOT "16 bit core".
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to 16-Bit Core

Who is online

Users browsing this forum: No registered users and 10 guests

cron