PIC16F877A External interrupt example with CCS C compiler

The microcontroller PIC16F877A has one external hardware interrupt at pin RB0/INT. When an interrupt occurs, 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 to configure and use the PIC16F877A external interrupt.

PIC16F877A External hardware interrupt example circuit:
The following circuit schematic shows a simple circuit that turns on and off the LED connected to RC0 using a push button connected to RB0 pin. The external interrupt is used to toggle the status of the LED.
PIC16F877A external interrupt circuit
PIC16F877A External interrupt example C code:
The C code below was tested with CCS C compiler version 5.051.

Leave a Reply

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