Interupts in Pic16f87 Microcontroller
Interupts in Pic16f87 Microcontroller
MICROCONTROLLER
1
Interrupt :- It is a disturbance signal ,
which disturbs the normal processing of a
controller or a processor . Also, it act as a
request from the device which generates it.
Once a processor or a
controller accepts an interrupt it stopes the
current executing program and it will provide
service for the received request . I.e., the
processor will now run the program requested
by the interrupted device. That program we
will call as Interrupt Service Routine (ISR).
4
All the interrupts in PIC 16f8788 can
either enabled or disabled at the primary level or
at the secondary level. I.e., all interrupts in PIC
16f8788 are maskable.
All Interrupts in PIC can be enabled or
disabled at a time that is called primary level
enabling or disabling of interrupts. We can also
enable or disable the interrupts individually that
we call secondary level enabling or disabling
interrupt.
5
INTCON Register :-
The INTCON register is a readable and
writable register, which contains various enable
and flag bits for the TMR0 register overflow, RB
port change and external RB0/INT pin interrupt.
6
RBIE: RB Port Change Interrupt Enable bit
1 = Enables the RB port change interrupt
0 = Disables the RB port change interrupt
TMR0IF: TMR0 Overflow Interrupt Flag bit
1-TMR0 register has overflowed (must be cleared
in software)
0-TMR0 register did not overflow
INTF: RB0/INT External Interrupt Flag bit
1 = The RB0/INT external interrupt occurred
(must be cleared in software)
0 = The RB0/INT external interrupt did not occur
RBIF: RB Port Change Interrupt Flag bit
1 = At least one of the RB7:RB4 pins changed
state; a mismatch condition will continue to set the
bit. Reading PORTB will end the mismatch
condition and allow the bit to be cleared (must be
cleared in software).
0 = None of the RB7:RB4 pins have changed state
PIE1 Register :-
The PIE1 register contains the individual
enable bits for the peripheral interrupts.
7
PSPIE: Parallel Slave Port Read/Write Interrupt
Enable bit(1)
1 = Enables the PSP read/write interrupt
0 = Disables the PSP read/write interrupt
Note: PSPIE is reserved on PIC16F873A/876A
devices; always maintain this bit clear.
ADIE: A/D Converter Interrupt Enable bit
1 = Enables the A/D converter interrupt
0 = Disables the A/D converter interrupt
RCIE: USART Receive Interrupt Enable bit
1 = Enables the USART to receive interrupt
0 = Disables the USART receive interrupt
TXIE: USART Transmit Interrupt Enable bit
1 = Enables the USART to transmit interrupt
0 = Disables the USART transmit interrupt
SSPIE: Synchronous Serial Port Interrupt Enable
bit
1 = Enables the SSP interrupt
0 = Disables the SSP interrupt
8
CCP1IE: CCP1 Interrupt Enable bit
1 = Enables the CCP1 interrupt
0 = Disables the CCP1 interrupt
TMR2IE: TMR2 to PR2 Match Interrupt Enable
bit
1 = Enables the TMR2 to PR2 match interrupt
0 = Disables the TMR2 to PR2 match interrupt
TMR1IE: TMR1 Overflow Interrupt Enable bit
1 = Enables the TMR1 overflow interrupt
0 = Disables the TMR1 overflow interrupt
PIR1 Register :-
The PIR1 register contains the individual
flag bits for the peripheral interrupts.
10
PIE2 Register :-
The PIE2 register contains the individual
enable bits for the CCP2 peripheral interrupt, the
SSP bus collision interrupts, EEPROM writes
operation interrupt, and the comparator interrupt.
11
PIR2 Register :-
The PIR2 register contains the flag bits for
the CCP2 interrupt, the SSP bus collision interrupt,
EEPROM write operation interrupt and the
comparator interrupt.