CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

difference between Global Interrupt Enable bit

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
srikrishna



Joined: 06 Sep 2017
Posts: 82

View user's profile Send private message

difference between Global Interrupt Enable bit
PostPosted: Sun Feb 02, 2020 4:30 am     Reply with quote

Hi guys! What is the difference between Global Interrupt Enable and Peripheral Interrupt Enable bit in pic 18f micro controller? What is their function?
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 5:01 am     Reply with quote

Read the chip data sheet.

The GIE (global interrupt enable) allows all enabled interrupts to start
responding.
The individual interrupt enables control each separate interrupt.
An interrupt handler is called when:
1) The GIE is TRUE.
2) The individual PIE is TRUE.
and 3) The physical interrupt flag is set.
srikrishna



Joined: 06 Sep 2017
Posts: 82

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 7:55 am     Reply with quote

What is unmasked interrupt ?


temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 8:16 am     Reply with quote

All peripherals that can cause an interrupt have a 'control' bit in a register to enable or disable that feature. If set to a '0' that peripheral will not generate an interrupt, If set to a '1' it will generate an interrupt IF both 'peripheral' interrupt AND global interrupt bits are set.
The 'mask' is a way to enable/disable entire sets or groups of interrupts based upon what your program is supposed to do.
srikrishna



Joined: 06 Sep 2017
Posts: 82

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 8:47 am     Reply with quote

temtronic wrote:
All peripherals that can cause an interrupt have a 'control' bit in a register to enable or disable that feature.


Is this INTCON register ??
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 9:22 am     Reply with quote

Enables all interrupts that are not masked off by their PIE bits.

The bits are all 'masks'. The GIE, is a mask for all the interrupts.
The PIE bits mask each individual interrupt.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 9:22 am     Reply with quote

There are several registers that are used depending on which PIC you have.
Generally speaking 'CONtrol' registers decide what to do, 'PIE' registers control 'enable' bits for peripheral device.
You need to read the datasheet of whatever PIC you're using as not all PICs have all peripherals !
srikrishna



Joined: 06 Sep 2017
Posts: 82

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 9:24 am     Reply with quote

temtronic wrote:
There are several registers that are used depending on which PIC you have.
Generally speaking 'CONtrol' registers decide what to do, 'PIE' registers control 'enable' bits for peripheral device.
You need to read the datasheet of whatever PIC you're using as not all PICs have all peripherals !

I am using pic18f2550.
srikrishna



Joined: 06 Sep 2017
Posts: 82

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 11:01 am     Reply with quote

I have read the datasheet of pic 18f2550. I guess INTCON, INTCON2 and INTCON3 controls the peripherals interrupt. PIR1,PIR2 registers contain the individual flag bits for the peripheral interrupts. PIE1, PIE2 registers contain the individual enable bits for the peripheral interrupts.
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sun Feb 02, 2020 2:33 pm     Reply with quote

No.
The INTCON registers contain GIE, then some of the physical interrupt flags
(though you don't need these when using an interrupt, they can be 'polled',
and they have to be cleared when the interrupt is exited (the compiler
does this for you unless you say otherwise). They also contain some 'P' bits
for some interrupts that sets the priority if interrupt priorities are enabled.
Have a look at this thread which discusses priorities:
<http://www.ccsinfo.com/forum/viewtopic.php?t=58480>

It is quite confusing, since they put a few of the priority bits here, and
the rest in the IPR registers.

The enables are then in the PIE registers, and the rest of the interrupt
flags in the PIR registers.

It suffers a little because as chips have grown areas that originally
contained things are no longer large enough, so new registers were
created, but to retain the reverse compatibility the old locations are
used for the older peripherals.

Key is that everything is described in the data sheet. If (for example), you
search for PIR1, you get basic layouts showing where it is and the bit
names, but then later in the sheet you get a whole page describing
every bit in the register.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group