Summary of PIC16F84A LED blinking code and Proteus simulation
This article provides C code (for HI-TECH C and MPLAB) and a minimal circuit to make an LED blink with a PIC16F84A microcontroller. It describes using a 0–20 MHz crystal (example 20 MHz), pulling MCLR high, and toggling RA0. The post includes configuration bit setup, compilation details (MPLAB v8.85, HI-TECH C v9.83), and a Proteus v7.10 simulation with downloads available.Parts used in the PIC16F84A LED Blinking Project:
- PIC16F84A microcontroller
- LED
- Current limiting resistor for LED
- Crystal oscillator (up to 20 MHz, example 20 MHz)
- Two load capacitors for the crystal (as required by the crystal)
- Pull-up resistor on MCLR (master reset) pin
- Power supply (VDD and VSS connections)
- Wires and breadboard or PCB for connections
This post provides the code to make an LED blink using PIC16F84A 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 PIC16F84A 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 PIC16F84A.
In this figure, first thing to note is that there is a crystal of 20MHz used with PIC16F84A[1]. You can use any crystal from 0 to 20MHz with PIC16F84A. MCLR master reset pin is pulled high to keep PIC16F84A out of reset. RA0 pin is being toggled in the code.
Code
The code for making LED blink using PIC16F84A is shown below.
Whenever you are writing code for PIC microcontrollers, then you have to include "htc.h" file in the code. After including "htc.h" file, configuration bits are being set in the code shown above. To understand the details of how these configuration bits are being programmed, you can read this post.
Downloads
LED blinking code using PIC16F84A 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: PIC16F84A LED blinking code and Proteus simulation
Quick Solutions to Questions related to PIC16F84A LED Blinking Project:
- What microcontroller is used in this project?
The PIC16F84A microcontroller is used in this LED blinking project. - What language and compiler are used for the code?
The code is written in C using the HI-TECH C compiler with MPLAB. - Which pin is toggled to blink the LED?
RA0 pin of the PIC16F84A is toggled in the code. - What crystal frequency can be used with PIC16F84A?
You can use any crystal from 0 to 20 MHz; the example uses a 20 MHz crystal. - How is MCLR handled in the circuit?
MCLR master reset pin is pulled high to keep PIC16F84A out of reset. - Where was the code compiled and simulated?
The code was compiled in MPLAB v8.85 with HI-TECH C v9.83 and simulated in Proteus v7.10. - Do I need to include any header file in the code?
Yes, you need to include htc.h when writing code for PIC microcontrollers as shown in the article. - Are configuration bits set in the provided code?
Yes, configuration bits are set in the code and the article references another post for details on those bits. - Is the project code and simulation available for download?
Yes, the article states that the code and Proteus simulation can be downloaded from the Downloads section.
Related projects
PIC Stepper Motor Controller using PIC16F84A with Proteus Simulation
Introduction Stepper motors are widely used in embedded systems and DIY electronics projects where precise position control is required. This PIC Stepper...
Programmers & ICSP · PIC16F84APIC Musical Doorbell using PIC16F84A with Proteus Simulation
IntroductionThis microcontroller project demonstrates a musical doorbell built around a PIC16F84A and a simple piezo sounder.Using two push buttons, the system allows...
Beginner Tutorials · PIC16C84Exploring the World of PIC Microcontrollers: An Architectural Overview
A Peripheral Interface Microcontroller (PIC), developed by General Instruments Microcontrollers in 1993, operates under software control and is programmed to execute various...
Games, Toys & CalculatorsExploring Leon’s Mini Random Number Generator (mRNG)
Sales Pitch Feeling overwhelmed by choices? Who isn't? Decision-making can be a maze. White, rye, or wheat? Pinstripes or polka dots? Feast...
Games, Toys & Calculators · PIC16F628ATIC TAC TOE game using PIC16F628
This project is not to introduce Tic Tac Toe. Everyone knows this game. It's to introduce two features. Bi-coloured LEDs, microcontrollers and...
Games, Toys & CalculatorsInteractive Blitz Chess: A Physical Blitz Chess Board Powered with PIC32
Introduction We created a companion system for physical chess boards to help players enjoy their fast paced blitz game with a chess...


