PIC16F84A external hardware interrupt example with CCS C

PIC16F84A External hardware interrupt example

The microcontroller PIC16F84A has a unique external interrupt at RB0 pin (hardware interrupt). When an interrupt occurred, the microcontroller immediately executes the code attached with the interrupt, after finishing the interrupt code the microcontroller returns to the main code.
This topic shows how to use PIC16F84A microcontroller external hardware interrupt. CCS C compiler is used in this example.
PIC16F84A external interrupt example circuit:
PIC16F84A external hardware interrupt example circuit
In the circuit schematic above we have just a button and an LED , the button is connected to the external interrupt RB0/INT pin and the LED is connected to RA0 pin. When the button is pressed, an interrupt will occur and the LED will toggle its state (ON or OFF).

The PIC16F84A microcontroller is powered with voltage of 5 Volts between VDD pin (#14) and VSS pin (#5).

Hardware Required:

  • PIC16F84A microcontroller   —> datasheet
  • 8MHz crystal oscillator
  • 2 x 22pF ceramic capacitor
  • LED
  • Push button
  • 10k ohm resistor
  • 330 ohm resistor
  • Bread board and jumper wires
  • PIC microcontroller programmer (PICkit 2, PICkit 3…)

PIC16F84A external interrupt example C code:
The C code below is for CCS C compiler, it was tested with version 5.051.

PIC16F84A external interrupt example video:
The following video has some details about the circuit and the CCS C code.


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top