PIC12F675 LED blinking code and Proteus simulation

Summary of PIC12F675 LED blinking code and Proteus simulation


This article shows C code (MPLAB + HI-TECH C) and a minimal circuit to blink an LED with a PIC12F675 using its 4 MHz internal oscillator, avoiding an external crystal and not using GP3 as reset so all other pins are available. It links to a downloadable code and Proteus simulation.

Parts used in the PIC12F675 LED Blinking Project:

  • PIC12F675 microcontroller
  • LED
  • Current limiting resistor for LED
  • Power supply (Vdd and Vss connections to pin 1 and pin 8)
  • Wiring/PCB or breadboard for connections
  • MPLAB IDE with HI-TECH C compiler (for building the code)
  • Proteus (for simulation)

This post provides the code to make an LED blink using PIC12F675 microcontroller. This code is written in C language using MPLAB with HI-TECH C compiler.

PIC12F675 LED blinking

This code is intended to be the first step in learning how to use PIC12F675 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 PIC12F675.

In this figure, first thing to note is that no crystal oscillator is used with PIC12F675, because internal oscillator of 4MHz frequency is being used as the clock source here. GP3 is usually the master reset pin for PIC12F675 microcontroller. But to increase total number of pins available for other purposes, here I am not using GP3 pin as reset pin. So, to make this PIC12F675 microcontroller work, you only need to provide power on the pin 1 and pin 8 of this microcontroller.

Code

The code for making LED blink using PIC12F675 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.

PIC12F675 LED blinking schematic

Downloads

LED blinking code using PIC12F675 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: PIC12F675 LED blinking code and Proteus simulation

Quick Solutions to Questions related to PIC12F675 LED Blinking Project:

  • Can the PIC12F675 blink an LED without an external crystal?
    Yes. The project uses the PIC12F675 internal 4 MHz oscillator, so no external crystal is required.
  • Do I need to use GP3 as the reset pin in this project?
    No. The article does not use GP3 as the reset pin to maximize available I/O pins.
  • Which pins must be powered for the PIC12F675 to work in this circuit?
    Provide power to pin 1 and pin 8 of the PIC12F675 as described in the article.
  • What compiler and IDE were used to compile the LED blinking code?
    The code was compiled in MPLAB v8.85 with the HI-TECH C v9.83 compiler.
  • Can I simulate the PIC12F675 LED blinking circuit before hardware implementation?
    Yes. The article states the simulation was made in Proteus v7.10 and a Proteus simulation download is provided.
  • Which header file must be included when writing code for PIC microcontrollers as shown?
    The article specifies including htc.h in the code.
  • Where can I download the example code and simulation files?
    The article provides a Downloads section with links to the code and Proteus simulation.
  • What is the purpose of this LED blinking code example?
    It is intended as the first step in learning to use the PIC12F675 microcontroller in projects.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter