INTCON - INTerrupt CONtrol Register

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

GIE

EEIE

TOIE

INTE

RBIE

TOIF

INTF

RBIF

These are the bits which are used to control interrupts in the PICmicro. You can read or write these bits, so that you can read back settings which you have made.

If the name ends in E this means that the bit is an enable bit which must be set to enable that particular interrupt source. If the name ends in an F this means that the bit is a flag bit and indicates the source of an interrupt. Note that the flag bits are set by the hardware irrespective of whether or not the interrupts are enabled.

GIE - Global Interrupt Enable

If this bit is clear the PICmicro will not respond to interrupts. Setting this bit "turns interrupts on". After reset interrupts are turned off. Note that even if the interrupts are turned off the flag bits still function as below and can be read and reset by software.

EEIE - EEPROM write complete Interrupt Enable

If this bit is set the PICmicro will generate an interrupt when it has completed writing a value into the EEPROM memory area (see later). Because writing to this area is slow it is useful to be able to do something else while a write completes. If you enable this interrupt you can write a handler which will execute when the write is complete.

TOIE - Timer Overflow Interrupt Enable

If this bit is set the PICmicro will be interrupted each time the timer "wraps round" from 255 to 0 (see the timer section for more details on this)

RBIE - poRt B Interrupt Enable

You can configure the PICmicro so that a change in input bits 4-7 on PORTB can trigger an interrupt. This is useful if you want to jump to a routine to read buttons or inputs when they change. It saves having to poll the inputs looking for a change. In an alternative configuration bit 0 of PORTB can be used as an interrupt source. In either case this bit must be set for interrupts from PORTB to be acted on.

TOIF - Timer Overflow Interrupt Flag

This flag is set by the PICmicro when the timer overflows. This makes it possible for the interrupt handler to decide that the timer was the cause of the interrupt and act accordingly. Note that to get the next interrupt from the timer you must clear this flag in your interrupt handler to allow the interrupt to occur again.

INTF - External INTerrupt Flag

This bit is set to indicate that an external interrupt signal on bit 0 of PORTB has caused the interrupt. To allow another interrupt from this source you must clear the bit in software.

RBIF - poRt B Interrupt Flag

If this bit is set it indicates that the interrupt was caused by a change in the input bits 0-4 on PORTB.