Summary of How to work with External (Hardware) Interrupts of PIC18F4550
PIC18F4550 supports hardware and software interrupts allowing immediate servicing of events (vs inefficient polling). Interrupts transfer execution to a fixed vector so peripherals like timers and ADC can be handled asynchronously, enabling concurrent tasks. The MCU provides many sources (external INTx, timers, ADC, EUSART, USB, CCP, comparator, resets, etc.) and uses 10 control registers to manage interrupt behavior. Example use: combining timer and ADC for a real-time temperature clock without polling.
Parts used in the PIC18F4550 Interrupts Project:
- PIC18F4550 microcontroller
- External interrupt pins (INT0, INT1, INT2)
- Timer peripherals (Timer0, Timer1, Timer2, Timer3)
- ADC module
- Analog comparator
- RB port (for change-detect interrupt)
- Streaming Parallel Port
- EUSART (receive and transmit)
- Master Synchronous Serial Port
- CCP modules (CCP1, CCP2)
- USB interface
- Oscillator with fail detection
- Reset and power management circuitry (Reset, Brown-Out, Watch-dog, Power-On Reset)
- EEPROM/Flash write control
- Bus collision detection
Interrupts are special events that require immediate attention. They cause the processor to cease the running task to serve a special task for which the interrupt event had occurred. After the special task is over, the processor resumes performing the original task.
A PIC microcontroller consists of both software and hardware generated interrupts. The hardware interrupts are produced by external hardware at certain pins of the microcontroller. The software interrupts, on the other hand, are generated by internal peripherals of the controller. This software interrupt helps the programmer to use more than one internal peripheral in single application and serve them individually when they respond.
· Reset, Brown-Out Reset, Watch-dog Reset, Power On Reset
· External Interrupt 0 (INT0)
· External Interrupt 1 (INT1)
· External Interrupt 2 (INT2)
· Timer 0 Interrupt
· Timer 1 Interrupt
· Timer 2 Interrupt
· Timer 3 Interrupt
· ADC Interrupt
· Analog Comparator Interrupt
· RB Port change Enable Interrupt
· Streaming Parallel Port Read/Write Interrupt
· EUSART Receive Interrupt
· EUSART Transmit Interrupt
· Master Synchronous Serial Port Interrupt
· CCP1 Interrupt (Capture, Compare, PWM)
· Oscillator Fail Interrupt
· USB Interrupt
· Data EEPROM/Flash Write Operation Interrupt
· Bus Collision Interrupt
· High/Low-Voltage Detect Interrupt
· CCP2 Interrupt
- What is the advantage of interrupts over polling?
Interrupts allow immediate servicing of events without continuous CPU waiting, making programs more efficient than polling. - How does the PIC18F4550 handle an interrupt?
On an interrupt, execution transfers to a predefined Interrupt Vector Address where the processor executes the interrupt service routine. - Can internal peripherals generate interrupts in PIC18F4550?
Yes, internal peripherals such as timers, ADC, EUSART, CCP, and others generate software interrupts. - Does PIC18F4550 support external hardware interrupts?
Yes, it supports external interrupts on pins INT0, INT1, and INT2. - What kinds of interrupts are available on PIC18F4550?
It includes resets, external INTx, timers, ADC, comparator, port change, parallel port, EUSART, MSSP, CCP1/CCP2, USB, EEPROM/Flash write, bus collision, voltage detect, and oscillator fail interrupts. - How many registers control interrupts in PIC18F4550?
A total of 10 registers are used to control interrupt operation in PIC18F4550. - Can interrupts help when using multiple peripherals like Timer and ADC?
Yes, interrupts let the controller serve each peripheral when they signal completion, allowing the CPU to perform other tasks concurrently. - Is polling recommended for handling events on PIC18F4550?
No, polling is inefficient compared to interrupts because the processor must continuously wait for event signals.
