Showing posts from July, 2014

LED Blinking PIC16F877 Code + Proteus Simulation using xc8

This post is all about how to blink an LED using PIC16F877 an 8 bit microcontroller from microchip. This is very basic tutorial for beginners. Code example is provided in download link below.
In this post I assumed that you must know following if not then please read them before proceeding further:
1.How to use MPLAB X IDE (Click here). 2.How to set Configuration bits in code (Click here).
You may download code, schematic and Proteus simulation from the download section at the bottom of this page. I am using MPLAB X IDE, XC8 Compiler.
Proteus Simulation:
I used PIC16F877 with PIN RB0 connected to an LED. MCLR is connected to 5VDC which means Controller is in Normal Operating mode (see datasheet for further details). Proteus simulation shows that LED is toggling after one second as I am using building delay functions I have set Crystal frequency 10MHz. The circuit is shown in figure 1.

This is the main code file showing the configuration bits area at the top and the main function in w…