LED Blinking with PIC16F877A: Proteus Simulation to Hardware Testing (Using MikroC PRO + TL866II Pro Mini)


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.

  1. How to set the crystal Oscillator with PIC16F877A?
  2. How to Interface the LED with the PIC Microcontroller?
  3. How to create a Simulation project in Proteus Professional software?
  4. How to create the first PIC microcontroller Coding project in MikroC Pro for PIC? 
  5. How to burn a hex file in the PIC16F877A IC?
  6. How to use the TL866II mini pro Universal Programmer for PIC microcontroller?
  7. 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:

  1. PIC16F877A Microcontroller
  2. LED
  3. Resistor 220 Ohm for LED
  4. Resistor 1k for MCLR
  5. Polar Capacitor 1uf 16v for Reset Circuit
  6. Tactile Push button for resetting the Circuit
  7. Crystal 8, 10, 12MHz
  8. Ceramic capacitor 22pf
  9. Breadboard 
  10. Jumper Dupont Wire Cable
  11.  Or use a development board 
  12. 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
}
}

📌 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.


Post a Comment

0 Comments