In this post, I’ll walk you through a step-by-step project where I designed, simulated, programmed, and tested an LED-blinking circuit using the PIC16F877A microcontroller. I used the software MikroC PRO for PIC (code development), the simulation tool Proteus, and programmed the microcontroller via a TL866II Pro Mini universal programmer. Then I tested the setup on a development board.
- How to set the crystal Oscillator with PIC16F877A?
- How to Interface the LED with the PIC Microcontroller?
- How to create a Simulation project in Proteus Professional software?
- How to create the first PIC microcontroller Coding project in MikroC Pro for PIC?
- How to burn a hex file in the PIC16F877A IC?
- How to use the TL866II mini pro Universal Programmer for PIC microcontroller?
- How to practically test your code using a Schematic diagram?
In this post, you are going to learn all the above topics in detail.
📌Required Components:
- PIC16F877A Microcontroller
- LED
- Resistor 220 Ohm for LED
- Resistor 1k for MCLR
- Polar Capacitor 1uf 16v for Reset Circuit
- Tactile Push button for resetting the Circuit
- Crystal 8, 10, 12MHz
- Ceramic capacitor 22pf
- Breadboard
- Jumper Dupont Wire Cable
- Or use a development board
- Power supply (e.g., +5 V)
📌Programmer:
TL866II Pro Mini
📌Software:
- MikroC PRO for PIC,
- Proteus for simulation
- TL866II MiniPro (CS version) Software for Hex file burning
📌Schematic diagram:
I am using Proteus Professional for schematic drawing and simulating the schematic. I have selected all the required components as shown in the Schematic diagram and made connections. I have compiled the code in MikroC Pro for PIC given below and uploaded the .hex file by double-clicking in the PIC microcontroller block, then gave the path of the .hex file.📌MikroC Pro for PIC coding Snip:
/// LAB 01: LED Blinking ///
/// Fayyaz Hussain ///
/// www.Circuitsum.blogspot.com ///
/// Date: 02 Nov, 2025 ///
#include // To include builtin libararies
sbit led at RB0_bit; // to set the Name of single bit of PORTB pin # RB0
void main() { // Starting main
TRISB = 0x00; // Delearing the PORTB as output
PORTB = 0x00; // Setting the initial Value 0 at PORTB
while (1){ // starting while loop
led=1; // setting RB0 at logic high
Delay_ms(200); // Delay of 200ms
led=0; // LED RBO logic low
Delay_ms(200); // Delay
}
}
/// LAB 01: LED Blinking ///
/// Fayyaz Hussain ///
/// www.Circuitsum.blogspot.com ///
/// Date: 02 Nov, 2025 ///
#include // To include builtin libararies
sbit led at RB0_bit; // to set the Name of single bit of PORTB pin # RB0
void main() { // Starting main
TRISB = 0x00; // Delearing the PORTB as output
PORTB = 0x00; // Setting the initial Value 0 at PORTB
while (1){ // starting while loop
led=1; // setting RB0 at logic high
Delay_ms(200); // Delay of 200ms
led=0; // LED RBO logic low
Delay_ms(200); // Delay
}
}
📌 If you found this tutorial useful:
- Please leave a comment below with your results or any issues you encountered.
- Feel free to download the code and simulation files (I can provide a link) and adapt for your own board.
- If you’d like me to post more advanced topics using PIC16F877A, just let me know.


0 Comments
Thanks for your precise views! I really appreciate your thoughtful feedback.