<<<Previous Tutorial | Next Tutorial>>> |
INTERRUPTS IN 16F877A
The interrupt sources in PIC can be broadly classified into .
1.External interrupt
2.Internal interrupts .
There are totally 14 sources of interrupts in PIC16F877A .
- Timer0 overflow interrupt
- Timer 1 interrupt
- Timer 2 interrupt
- Capture compare interrupt ccp1.
- Capture compare interrupt ccp2.
- Comparator Interrupt
- USART Transmitter interrupt
- USART Receiver Interrupt
- Synchronous Serial Port interrupt
- EEPROM Write Interrupt
- Analog to Digital Converter interrupt
- Parallel slave port read write interrupt
- Bus collision interrupt
- External interrupt (RB0/INT0)
The global register for the interrrupt is INTCON .The following tables show you the individual bits .
GIE | PEIE | TOIE | INTE | RBIE | TOIF | INTF | RBIF |
The description of the individual bits are given below .The status of different interrupts when set as o and 1 .
BIT | NAME | WHEN SET 1 | WHEN SET O |
GIE | Global interrupt bit | Enable all | Disable all |
PEIE | Peripheral interrupt enable bit | Enable all unmaskable peripheral interrupts | Disable all peripheral interrupts |
TOIE | Timer 0 overflow interrupt enable bit | Enable | Disable |
INTE | RB0/INT external interrupt enable bit | Enable | Disable |
RBIE | RB port change interrupt enable bit | Enable | Disable |
TOIF | Timer 0 overflow interrupt flag | TMR0 reg overflows | |
INTF | RB0/INT external interrupt flag | External interrupt occurs | No interrupt |
RBIF | RB port change interrupt flag bit | One line changes its state from RB7 to RB4 | No line changes |
The first five bits are configuration bits and the next 3 lower bits are FLAGS .That will be set as 1 when the corresponding interrupt occours .It is the programmers responsiblity to clear those bits .It wont be cleared automatically .Its for the reson because if another interrupt occours while processing the previous interrupt it will lead to chaos .So the task is given to the programmer to clear the bits .
In addition to INTCON reg peripheral interrupt also has 4 more reg PIE1 , PIE2 corresponding to PIEX and PIR1 and PIR2 coressponding to PIRX.Let us see these registers in the next tutorials .
<<<Previous Tutorial | Next Tutorial>>> |
No comments:
Post a Comment