This post provides the code to make an LED blink using PIC16F877Β microcontroller. This code is written in C language using MPLAB with HI-TECH C compiler. This code is intended to be the first step in learning how to use PIC16F877Β microcontroller in your projects. You can download this code from the βDownloadsβ section at the bottom of this page.
Following figure shows the minimum circuitΒ requiredΒ to make an LED blink with PIC16F877.
In this figure, first thing to note is that there is a crystal of 20MHz used withΒ PIC16F877[1]. You can use any crystal from 0 to 20MHz withΒ PIC16F877.Β MCLRΒ master reset pin is pulled high to keepΒ PIC16F877Β out of reset. RB0 pin is being toggled in the code.
Code
The code for making LED blink usingΒ PIC16F877Β is shown below.
Downloads
LED blinking code usingΒ PIC16F877Β was compiled inΒ MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10.Β To download code andΒ ProteusΒ simulationΒ click here.
For more detail: PIC16F877 LED blinking code and Proteus simulation